How to stop page loading using selenium-web driver? require 'selenium-webdriver' require 'win32ole' driver = Selenium::WebDriver.for :firefox driver.get "https://example.com/" Say after sleep(10), I want to stop the loading of the page.Because the page is taking too long time to load. Any chance to do that using selenium-web driver? Thanks
on 2013-02-04 14:25
on 2013-02-04 15:24
Getting the below error:
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill':
Timeout:
:Error (Timeout::Error)
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in
`rbuf_fill'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in
`readuntil'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in
`read_status_line'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in
transport_r
equest'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in
`transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1286:in `block in
request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/http/default.rb:83:in `response_for'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/http/default.rb:39:in `request'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/http/common.rb:40:in `call'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/bridge.rb:615:in `raw_execute'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/bridge.rb:593:in `execute'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/bridge.rb:561:in `find_element_by'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/common/search_context.rb:42:in `find_element'
from C:/Documents and Settings/rakshiar/My
Documents/userdata/Ruby/Scrip
ts/answerlist.rb:29:in `rescue in <main>'
from C:/Documents and Settings/rakshiar/My
Documents/userdata/Ruby/Scrip
ts/answerlist.rb:21:in `<main>'
on 2013-02-04 16:00
require 'selenium-webdriver' require 'timeout' driver = Selenium::WebDriver.for :firefox Timeout.timeout(10) do driver.get "https://example.com/" end Regarding your exception, look at line 21 in answerlist.rb. That's failing.
on 2013-02-04 16:11
Joel Pearson wrote in post #1095134: > require 'selenium-webdriver' > require 'timeout' > > driver = Selenium::WebDriver.for :firefox > Timeout.timeout(10) do > driver.get "https://example.com/" > end > > Regarding your exception, look at line 21 in answerlist.rb. That's > failing. Not working- Is there anyway to stop page load?
on 2013-02-04 16:28
require 'rubygems' require 'selenium-webdriver' require 'win32ole' driver = Selenium::WebDriver.for :firefox driver.manage.timeouts.implicit_wait = 10 driver.get "https://prod.example.com/" element = driver.find_element :name => "j_username" element.send_keys "####" element = driver.find_element :name => "j_password" element.send_keys "#####" driver.find_element(:name, "login").submit #<== from here the code went to forever loading and after that thrown error.Not reaching to the below statement. tried also - "driver.manage.timeouts.implicit_wait = 10". But no result. driver.find_element(:link_text, "employelink").click
on 2013-02-04 16:31
Do you get any response from that submit if you locate and click it as a button?
on 2013-02-04 16:34
Joel Pearson wrote in post #1095143: > Do you get any response from that submit if you locate and click it as a > button? After clicking on a submit, it's bringing me to the correct page,but browser is showing "Loading Loading...... loading...." after that error has been thrown and the browser still loading,after a long while - I can see that the page is loaded. Thanks
on 2013-02-04 16:52
Love U Ruby wrote in post #1095142: > require 'rubygems' > require 'selenium-webdriver' > require 'win32ole' > > driver = Selenium::WebDriver.for :firefox > driver.manage.timeouts.implicit_wait = 10 ### Here should I need to put this - "driver.manage.timeouts.page_load = 180"?###### > driver.get "https://prod.example.com/" > > element = driver.find_element :name => "j_username" > element.send_keys "####" > element = driver.find_element :name => "j_password" > element.send_keys "#####" > driver.find_element(:name, "login").submit #<== from here the code went > to forever loading and after that thrown error.Not reaching to the below > statement. tried also - "driver.manage.timeouts.implicit_wait = 10". But > no result. ### or here should I need to put this - "driver.manage.timeouts.page_load = 180"?###### Please confirm me! > driver.find_element(:link_text, "employelink").click
on 2013-02-04 19:00
Is there any chance to stop loading of a page in a browser? Just we do manually on a browser by clicking on a cross sign. Thanks
on 2013-02-05 20:00
Love U Ruby wrote in post #1095127: > Getting the below error: > > C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill': > Timeout: > :Error (Timeout::Error) > from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in > `rbuf_fill' > from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in > `readuntil' > from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' > from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in > `read_status_line' Is there anyway to handle these exception,try to make alive the driver continue with the browser till the page load completed?
on 2013-02-05 21:36
How long does the page take to load when you do this manually? Adjust your timeout accordingly. You can add your page load timeout setting anywhere after creating the driver object.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.