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?

S. A. Malik
  • 3,465
  • 6
  • 37
  • 56
  • are you sure that the script has executed and displayed the popup by the time you read it? you could try : driver.execute_script . http://stackoverflow.com/questions/7565562/how-to-execute-javascript-in-ruby-written-webdriver-test , or , https://code.google.com/p/selenium/wiki/RubyBindings. hav u tried using capybara selenium ? – ajt Jun 10 '13 at 09:51
  • If you still in trouble,can you give the url? I will try it from my end. – Arup Rakshit Jun 22 '13 at 09:18

0 Answers0