<tfoot id='GlHLX'></tfoot>

      <i id='GlHLX'><tr id='GlHLX'><dt id='GlHLX'><q id='GlHLX'><span id='GlHLX'><b id='GlHLX'><form id='GlHLX'><ins id='GlHLX'></ins><ul id='GlHLX'></ul><sub id='GlHLX'></sub></form><legend id='GlHLX'></legend><bdo id='GlHLX'><pre id='GlHLX'><center id='GlHLX'></center></pre></bdo></b><th id='GlHLX'></th></span></q></dt></tr></i><div id='GlHLX'><tfoot id='GlHLX'></tfoot><dl id='GlHLX'><fieldset id='GlHLX'></fieldset></dl></div>
      • <bdo id='GlHLX'></bdo><ul id='GlHLX'></ul>
    1. <legend id='GlHLX'><style id='GlHLX'><dir id='GlHLX'><q id='GlHLX'></q></dir></style></legend>

        <small id='GlHLX'></small><noframes id='GlHLX'>

        如何为 python selenium 3.8.0 设置'driver.get'的超时?

        时间:2023-07-04

          <tbody id='2mVAO'></tbody>
        • <i id='2mVAO'><tr id='2mVAO'><dt id='2mVAO'><q id='2mVAO'><span id='2mVAO'><b id='2mVAO'><form id='2mVAO'><ins id='2mVAO'></ins><ul id='2mVAO'></ul><sub id='2mVAO'></sub></form><legend id='2mVAO'></legend><bdo id='2mVAO'><pre id='2mVAO'><center id='2mVAO'></center></pre></bdo></b><th id='2mVAO'></th></span></q></dt></tr></i><div id='2mVAO'><tfoot id='2mVAO'></tfoot><dl id='2mVAO'><fieldset id='2mVAO'></fieldset></dl></div>
              <bdo id='2mVAO'></bdo><ul id='2mVAO'></ul>

                <small id='2mVAO'></small><noframes id='2mVAO'>

                  <tfoot id='2mVAO'></tfoot>
                1. <legend id='2mVAO'><style id='2mVAO'><dir id='2mVAO'><q id='2mVAO'></q></dir></style></legend>
                2. 本文介绍了如何为 python selenium 3.8.0 设置'driver.get'的超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 selenium 测试中,您使用

                  In selenium tests, you open a webpage using

                  from selenium import webdriver
                  driver = webdriver.Firefox()
                  driver.get("whateverpage.org.com")
                  

                  如何为 selenium 版本 3.8.0 和 python 2.7.12 设置此命令的超时时间?

                  How can I set the timeout of this command for selenium version 3.8.0 and python 2.7.12?

                  推荐答案

                  页面加载设置超时/strong>你可以诱导set_page_load_timeout(seconds).

                  To set the time out for Page Loading you can induce the set_page_load_timeout(seconds).

                  def set_page_load_timeout(self, time_to_wait):
                      """
                      Set the amount of time to wait for a page load to complete
                      before throwing an error.
                  


                  参数

                  time_to_wait: The amount of time to wait
                  


                  用法

                  driver.set_page_load_timeout(3)
                  


                  示例

                  from selenium import webdriver
                  from selenium.common.exceptions import TimeoutException
                  
                  driver = webdriver.Chrome(executable_path=r'C:UtilityBrowserDriverschromedriver.exe')
                  driver.set_page_load_timeout(2)
                  try :
                      driver.get("https://www.booking.com/hotel/in/the-taj-mahal-palace-tower.html?label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaGyIAQGYATG4AQbIAQzYAQHoAQH4AQKSAgF5qAID;sid=338ad58d8e83c71e6aa78c67a2996616;dest_id=-2092174;dest_type=city;dist=0;group_adults=2;hip_dst=1;hpos=1;room1=A%2CA;sb_price_type=total;srfid=ccd41231d2f37b82d695970f081412152a59586aX1;srpvid=c71751e539ea01ce;type=total;ucfs=1&#hotelTmpl")
                      print("URL successfully Accessed")
                      driver.quit()
                  except TimeoutException as e:
                      print("Page load Timeout Occurred. Quitting !!!")
                      driver.quit()
                  


                  控制台输出

                  Page load Timeout Occurred. Quitting !!!
                  


                  文档

                  您可以在此处找到关于 pageLoadTimeout 的详细讨论 Selenium 中的 pageLoadTimeout 不起作用

                  根据 Python 3.x,如果我们不处理异常,则会观察到以下日志消息:

                  As per Python 3.x if we don't handle the exception the following log messages are observed :

                      raise exception_class(message, screen, stacktrace)
                  selenium.common.exceptions.TimeoutException: Message: timeout
                    (Session info: chrome=62.0.3202.94)
                    (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.2.9200 x86_64)
                  

                  这篇关于如何为 python selenium 3.8.0 设置'driver.get'的超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                    • <bdo id='Ni7J8'></bdo><ul id='Ni7J8'></ul>
                    • <i id='Ni7J8'><tr id='Ni7J8'><dt id='Ni7J8'><q id='Ni7J8'><span id='Ni7J8'><b id='Ni7J8'><form id='Ni7J8'><ins id='Ni7J8'></ins><ul id='Ni7J8'></ul><sub id='Ni7J8'></sub></form><legend id='Ni7J8'></legend><bdo id='Ni7J8'><pre id='Ni7J8'><center id='Ni7J8'></center></pre></bdo></b><th id='Ni7J8'></th></span></q></dt></tr></i><div id='Ni7J8'><tfoot id='Ni7J8'></tfoot><dl id='Ni7J8'><fieldset id='Ni7J8'></fieldset></dl></div>
                      <legend id='Ni7J8'><style id='Ni7J8'><dir id='Ni7J8'><q id='Ni7J8'></q></dir></style></legend>
                        <tfoot id='Ni7J8'></tfoot>

                          <tbody id='Ni7J8'></tbody>

                        <small id='Ni7J8'></small><noframes id='Ni7J8'>