vmi / selenese-runner-java

Selenium IDE native format (selenese and side) interpreter.
Other
140 stars 83 forks source link

Name locator for elements with spaces in the name #339

Open blutorange opened 1 year ago

blutorange commented 1 year ago

Today I was creating a Selenium IDE test for a page that had an element with a name attribute containing a space, e.g. name=btnDisable Validation. With the Firefox browser addon, the locator name=btnDisable Validation worked and the element was found. When I tried running the test via selenese-runner-java, it failed with the error message that it could not locate the element.

Taking a look at the source, this appears to be a feature? selenese-runner-java splits the argument on on the first space, and uses the second part as an index filter or regexp filter on the value:

https://github.com/vmi/selenese-runner-java/blob/master/src/main/java/jp/vmi/selenium/selenese/locator/NameHandler.java#L30-L31

Now I was wondering -- is this standard Selenium IDE behavior or is this specific to selenese-runner-java? The documentation pages from Selenium IDE unfortunately don't mention the selector syntax (or I didn't find it). Or was this perhaps once a feature of Selenium IDE and since removed? Or is it perhaps just the browser addon that's not behaving as it should?

I can work around this for now but it would be great if selenese-runner-java could be as close as possible to Selenium IDE

blutorange commented 1 year ago

At least in the current Selenium IDE repo there does not seem to be any logic that splits locators on space and looks for index=... or value=...

https://github.com/SeleniumHQ/selenium-ide/blob/53dc09104c2ec801ecd78d1878b3fd9eb036e892/packages/side-runtime/src/webdriver.ts#L1785-L1797