I have a below html which am trying to test using ruby selenium web driver
-
According to the Selenium documentation :css
is not a valid selector for find_elements
.
It specified :class, :class_name, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath
to be valid selectors.
The :css
selector do still work in many situations, however it does not always work as you would expect. For example would div.container-fluid.container-results > div#0
be invalid for selenium, even tho it is valid for the browsers.
You could use xpath or some of the other selectors to get the svg.
If you want to use the css selector to find it, you could use nokogiri, here is an example:
selenium_driver = Selenium::WebDriver.for :chrome
selenium_driver.get("http://stackoverflow.com/")
# do whatever with selenium
doc = Nokogiri::HTML(selenium_driver.page_source)
doc.css("div.container-fluid.container-results >div##{row_number.to_i-1} >ul >li >a >svg")