lundi 15 août 2016

Can't find element with selenium

I am using selenium-webdriver with capybara for testing my rails application, i have issue where i can't find specific edit link for my record.

I have following code:

rows=page.driver.browser.find_elements(:xpath, "//tr")
rows.each_with_index do |tr, index|
  if index==0
    next
  end
  if tr.text.include? @user_for_update1.email
    tr.find_element(:xpath, "//a[@title='Edit']").click
  end
end 

This click is always called on first element with Edit link, even if tr was referenced on row with specific email.

Does anyone knows what can be wrong here, or is there any other way which i can use to do this like to find tr which contains td with specific email, and can contains() be used to match tr with td (which contains "some@email.com").

Thanks

Aucun commentaire:

Enregistrer un commentaire