简体   繁体   English

TimeoutException:消息:等待页面加载超时

[英]TimeoutException: Message: Timed out waiting for page to load

I want to Open browser in Edge with IE mode.我想用 IE 模式在 Edge 中打开浏览器。 My environment: IE7, windows 11, Python 3.10.4, Edge version 108.0.1462.46 And I follow the required configuration from below: https://www.selenium.dev/documentation/ie_driver_server/我的环境:IE7、Windows 11、Python 3.10.4、Edge 版本 108.0.1462.46 我按照下面的要求配置: https ://www.selenium.dev/documentation/ie_driver_server/

  1. I made the same value for Enhanced Protected Mode by setting the REG_DWORD 2500 value to 0 in Zones 0,1,2,3,4: Registry Editer path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones我通过在区域 0、1、2、3、4 中将 REG_DWORD 2500 值设置为 0,为增强保护模式设置了相同的值:注册表编辑器路径:Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones
  2. I add the IEDriverServer to my PATH我将 IEDriverServer 添加到我的 PATH

Is there any wrong steps about my configuration?我的配置有什么错误的步骤吗?

Below is my code:下面是我的代码:

*** Settings ***
Library   SeleniumLibrary

*** Variables ***
${IEDriver}  D:\\IEDriver\\64bits\\IEDriverServer.exe

*** Test Cases ***
Example Test
    Open Browser  https://www.google.com.tw/  ie  executable_path=${IEDriver}  options=ignore_zoom_level=True; attach_to_edge_chrome=True; edge_executable_path="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"
    Maximize Browser Window

After I executing my code, I can open google in Edge with IE mode, but after that web page stuck and always get thie error message: TimeoutException: Message: Timed out waiting for page to load.执行我的代码后,我可以使用 IE 模式在 Edge 中打开谷歌,但在该网页卡住之后,总是会收到错误消息:TimeoutException: Message: Timed out waiting for page to load。

This option may work for you in Windows 11 IE mode automation.此选项可能适用于 Windows 11 IE 模式自动化。 Check it out:看看这个:

ignore_protected_mode_settings = True

UPDATE更新

Or you can simply try setting the page load timeout according to your requirement:或者您可以简单地尝试根据您的要求设置页面加载超时:

*** Variables ***
${orig timeout}    15 seconds
*** Test Cases ***
Example Test
    Set Selenium Timeout    ${orig timeout}

If the element you'd like to interact with has been fully loaded, you can skip the page loading and continue.如果您要与之交互的元素已完全加载,您可以跳过页面加载并继续。 A native Python example:原生 Python 示例:

driver.set_page_load_timeout(10)
try:
   driver.get('https://google.com')
except TimeoutException:
    print
    '!!!!!!time out after 10 seconds!!!!!!'
    driver.execute_script("window.stop()")

In Robot Framework:在机器人框架中:

*** Test Cases ***
Example Test
    Set Selenium Timeout    ${orig timeout}
    TRY
        Open Browser    https://www.google.com    ie    options=ignore_zoom_level=True; attach_to_edge_chrome=True; edge_executable_path="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"
    EXCEPT    '!!!!!!time out after 10 seconds!!!!!!'
        Execute Javascript    window.stop()
    END
    Maximize Browser Window

And I found something interesting: I use python and selenium and below is my code:我发现了一些有趣的东西:我使用 python 和 selenium,下面是我的代码:

ieOptions = webdriver.IeOptions()
ieOptions.add_additional_option("ie.edgechromium", True)
ieOptions.add_additional_option("ie.edgepath",'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')
driver = webdriver.Ie(options=ieOptions)

driver.maximize_window()
driver.get('https://google.com')
driver.quit()

If I remove this line "driver.get('https://google.com')" and my code runs perfectly.如果我删除这一行“driver.get('https://google.com')”并且我的代码运行完美。 But If I add it back, the page will go to goole and stuck there (It means that this code will not do driver.quit()但是如果我把它加回去,页面就会变成 goole 并卡在那里(这意味着这段代码不会执行 driver.quit()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 selenium.common.exceptions.TimeoutException:消息:通过 Selenium 使用 IEDriverServer 和 Internet Explorer 等待页面加载超时 - selenium.common.exceptions.TimeoutException: Message: Timed out waiting for page to load using IEDriverServer and Internet Explorer through Selenium 等待页面加载超时 - Timed out waiting for page to load Selenium 等待页面加载时出现超时错误 - Selenium timed out error on waiting for page to load 硒超时,等待代理加载页面 - selenium Timed out waiting for page load with proxys 即使没有页面重定向,等待页面加载点击事件也超时 - Timed out waiting for page to load on a click event even though there is no page redirection org.openqa.selenium.TimeoutException:超时:从渲染器接收消息超时:19.083 - org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 19.083 获取 org.openqa.selenium.TimeoutException:超时:从渲染器接收消息超时:10.000 - Getting org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 10.000 Python Selenium Webdriver无法TimeoutException:等待元素时出现消息 - Python Selenium webdriver cannot TimeoutException: Message when waiting for an element 等待驱动程序服务器停止超时 - Timed out waiting for driver server to stop 等待 45 秒让 Firefox 启动超时 - Timed out waiting 45 seconds for Firefox to start
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM