1

I am buidling a test script for a webpage which posts data to some application and shows the result back. The problem is that the script does not load the data from the javascript modal popup. I would like to state here that it is not an alert it is a simple javascript popup.

The popup has a link in it like Google The script click a link and then the popup appears but it can not read the link from the popup. With a lot of testing I have came to the conclusion that the script runs through the page before the popup appears. This is the reason that it does not read the popup link. Follow code is being used to read popup.

@driver.find_element(:css, "a.popup-link").attribute("href")

I have also tried both implicit and explicit waits but still the problem persists. I have set the implicit wait to 30 seconds by using

 @driver.manage.timeouts.implicit_wait = 30

The explicit wait like this

wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { driver.find_element(:css => "a.popup-link") }
element = @driver.find_element(:css, "a.popup-link")

What should i do so that i can read the popup link properly? Any suggestions?

2
  • are you sure that the script has executed and displayed the popup by the time you read it? you could try : driver.execute_script . stackoverflow.com/questions/7565562/… , or , code.google.com/p/selenium/wiki/RubyBindings. hav u tried using capybara selenium ? Commented Jun 10, 2013 at 9:51
  • If you still in trouble,can you give the url? I will try it from my end. Commented Jun 22, 2013 at 9:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.