selenium-rs icon indicating copy to clipboard operation
selenium-rs copied to clipboard

Finding Elements within Elements

Open nixpulvis opened this issue 4 years ago • 0 comments

I'm pretty used to the Ruby gem which has some pretty ergonomic interfaces. The first one I notice myself reaching for is the Find implementation on the Element class. This makes it possible to do something like the following:

driver.find_elements(class: 'article').each do |article|
    title = article.find_element(class: 'title').text
    date = article.find_element(class: 'date').text
    body = article.find_elements(tag_name: 'p').last.text
end

I'm not sure what the best way to emulate this functionality is today, nor do I actually know how it's implemented in Ruby to be honest. It's just really nice to have.

nixpulvis avatar Feb 21 '21 03:02 nixpulvis