How to Click on a search button that has no css or id selectors

Hello, I am trying to click on a search bar button. I am using python RF browser library. So far, I’ve tried Click With Options, Mouse Button, and xpath but none seems to do the trick.

Code line is preceded by:
Fill Text id=searchfor product

Then the html is like this:

button type=“submit” class=“wsp-search__btn” aria-label=“Zoeken” data-analytics-id=“px_search_button_click” data-test=“search-button”>
svg version=“1.1” viewBox=“0 0 24 24” aria-hidden=“true” class=“svg-inline–bi bi-search-vi bi-lg” data-test=“icon-search-vi” focusable=“false”>
</button

svg version=“1.1” viewBox=“0 0 24 24” aria-hidden=“true” class=“svg-inline–bi bi-search-vi bi-lg” data-test=“icon-search-vi” focusable=“false”></svg

How does your Click Keyword look like?
What do you use as an argument for the locator?
What error message do you get?

Looking at your html, something like

Click id=px_search_button_click

should work

To try out different locators and keywords during runtime, I recommend to use VS Code as an IDE together with the RobotCode Extension and Debug your test case.
This will give you the chance to execute any Robot Framework commands while the test run is executed step by step.

Thanks, I have VScode and RobotCode active.

Because id=px_search_button_click is not the right locator, it resides within a data-test

Error: locator.click: Timeout 10000ms exceeded.
Call log:

  • waiting for locator(‘id=px_search_button_click’)

ok, strange.

You can also try a text locator like

Click "Zoeken"

I guess you have already tried xpaths like

Click //button[@type='submit']

etc.

If that all does not work, you could check in the Developer Tools if the button is inside an iframe element for whatever reason. Then you can use the iframe syntax of the Browser Library using >>>

I often go into Debug mode and try out my locators using the Highlight Elements Keyword, when having problems to find elements

This xpath works. Passed!

Guess I didn’t indent it correctly before.

Thanks