【问题标题】:Code stops executing after opening browser through webdriver using python使用python通过webdriver打开浏览器后代码停止执行
【发布时间】:2020-06-04 16:26:38
【问题描述】:

我一直在尝试使用 selenium 中的 webdriver 在 Internet Explorer 中打开多个浏览器窗口。一旦它到达 get(url) 行,它就会停在那里并最终超时。我添加了一个不执行的打印行。我尝试了各种方法,下面的一个是我用来在 Chrome 中打开多个标签的代码的 Ie 版本。即使我删除了前 3 行,它仍然只能打开 google.com。我已经用谷歌搜索了这个问题并查看了其他帖子,但没有任何帮助。非常感谢任何建议,谢谢!

options = webdriver.IeOptions()
options.add_additional_option("detach", True)
driver = webdriver.Ie(options = options, executable_path=r'blahblah\IEDriverServer.exe')
driver.get("http://google.com")
print("syrfgf")
driver.execute_script("window.open('about:blank', 'tab2');")
driver.switch_to.window("tab2")
driver.get("http://yahoo.com")

【问题讨论】:

标签: python selenium selenium-webdriver webdriver


【解决方案1】:

您需要替换您提供的url

http://google.com

使用正确的url 如下:

https://www.google.com/

应按如下语法图表示:

【讨论】:

  • 我已经尝试过这样做,但它仍然在做同样的事情
猜你喜欢
  • 1970-01-01
  • 2017-06-25
  • 1970-01-01
  • 1970-01-01
  • 2022-11-18
  • 1970-01-01
  • 2019-04-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多