Ugh
The selenium does support finding elements by class[1], but you are correct and that functionality is not directly supported by the Selenium2Library. This could be good addition to the Selenium2Library and you could raise an issue about it. Even better if an pull request could be made too.
But you can find element by using xpath and targeting only the class name. If you have only one class name in the element then this works nicely:
//*[@class="value"]
But if you have multiple classes in a single element, you need to do something like this:
//*[contains(concat(' ', @class, ' '), ' value ')]
Last example is copy/pasted from stack overflow: http://stackoverflow.com/questions/1604471/how-can-i-find-an-element-by-css-class-with-xpath
-Tatu
Send from my mobile
[1] http://selenium-python.readthedocs.io/locating-elements.html?highlight=Find%20by%20class#locating-elements-by-class-name
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
To post to this group, send email to robotframe...@googlegroups.com.
Ugh
The star in xpath is a wild card and will match any element. The xpath is quite powerful and it can actually do very complex things (In my mind xpath is like Perl, very powerful and most of the time very write once). In any case, reading some tutorials[1] might be useful.
The css selector looks handy and better than the xpath. I mostly use xpath, because of the nature of my application and some limitations of the css selector. But if you only need to select by a class, I would definitely use css selector, because it is shorter to write and therefore easier to read.
The exposing the selenium class selector could be useful also on Selenium2Library side. Perhaps raising a issue and thinking on the issue which way to go is the best option.
-Tatu
Send from my mobile
[1] http://www.w3schools.com/xsl/xpath_syntax.asp