“格式错误的URL:无法访问死对象"硒中试图打开谷歌时 [英] "Malformed URL: can't access dead object" in selenium when trying to open google

查看:134
本文介绍了“格式错误的URL:无法访问死对象"硒中试图打开谷歌时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用python硒开发一个非常复杂的测试用例.在它的中间(页面可能正在加载,iframe内包含iframe等),我只想通过执行以下操作来打开网页:

With python selenium I am currently developing a very complex test case. In the midst of it (page might be loading, with iframes inside iframes etc), I just want to open a webpage by doing as follows:

driver.get("https://www.google.com")

但是出现以下错误:

InvalidArgumentException: Message: Malformed URL: can't access dead object

我不能在硒测试中仅在某处打开网页吗?为什么这是格式错误的URL?死物与导航到新网页有什么关系??

Can't I open just a webpage somewhere in my selenium tests? Why is this a malformed URL? What do dead objects have to do with navigating to a new webpage...?

推荐答案

我认为您切换到了.get()之前的框架.而且您无法在框架中打开网址.尝试driver.switch_to_default_content()

I think you switched into a frame just before .get(). And you cannot open an url in the frame. Try driver.switch_to_default_content()

这篇关于“格式错误的URL:无法访问死对象"硒中试图打开谷歌时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆