Home > Back-end >  Use of find elements in Selenium using Ruby
Use of find elements in Selenium using Ruby

Time:12-31

Can anyone please help me find how can I write find elements method in Ruby and click on first element ? I tried this but did not work.

sl=driver.find_elements(:xpath, "//*[@title='Women']")

sl[0].click

The error given is as follows

undefined method `click' for nil:NilClass (NoMethodError)

CodePudding user response:

You can use find with css selector:

driver.page.find('[title="Women"]').click
  • Related