small medium large xlarge

02 Oct 2012, 09:59
Wari Wahab (6 posts)

With the new Selenium-webdriver, I believe, test like these does not seem to work anymore. Chrome gives: @Element must be displayed to click@ and firefox give @Element is not currently visible and so may not be interacted with@. This makes my other sites tests fails.

Fails the same way in Windows as well in Linux.

Even adding a sleep value fails. Have no idea why this behaviour changed.

02 Oct 2012, 19:31
Erin Dees (207 posts)

Hello, Wari.

Sorry about this. It looks like the markup on the login page has changed, and it now has multiple forms containing fields labeled email and submit. The test is picking up one of the email fields on a form that’s hidden.

The good news is that the fix is easy. By switching to XPath, we can focus on the specific form controls we need:

EmailField    = '//div[@id="content"]//input[@name="email"]'
PasswordField = '//div[@id="content"]//input[@name="password"]'
SubmitButton  = '//div[@id="content"]//button[@type="submit"]'

Given /^I am logged in$/ do
  browser.goto ''
  browser.text_field(:xpath => EmailField   ).set ENV['PRAG_EMAIL']
  browser.text_field(:xpath => PasswordField).set ENV['PRAG_PASSWORD']
  browser.button(:xpath => SubmitButton).click

Good catch, and thanks for writing in. The next beta (in a couple of weeks, most likely) will contain the fix.



03 Oct 2012, 06:49
Wari Wahab (6 posts)

Sweet, I was playing quite heavily on this code, and browsing the web all over for solutions to issues I’m having on my side. I now have better understanding of these cases, and for some even obscure problems, the @selenium-webdriver@ seems to work better. And with the @PageObject@ gem, I’m able to switch between both with minimal hassle, especially if @watir-webdriver@ can’t seem to do what I wanted.

You must be logged in to comment