[英]WebDriverException: Message: [(NS_ERROR_FAILURE)" location: "JS frame :: chrome://marionette/content/proxy.js] with Selenium GeckoDriver and Python
I am downloading multiple reports from a website.我正在从一个网站下载多个报告。 Each report has its own URL.每个报告都有自己的 URL。 Some URLs are loading fine without a problem.一些 URL 加载正常,没有问题。
But there is one URL that produces the following error.但是有一个 URL 会产生以下错误。 All URLs have the same pattern except for query parameter.除了查询参数外,所有 URL 都具有相同的模式。 If I open the URL on my browser it works fine.如果我在浏览器上打开 URL,它工作正常。
I am using Selenium and the Firefox Driver.我正在使用 Selenium 和 Firefox 驱动程序。
Below is my code下面是我的代码
if __name__ == "__main__":
firefox_options = Options()
#firefox_options.headless = True
driver = webdriver.Firefox(options=firefox_options, executable_path=firefox_driver_location)
logged_in = "no"
for query in sa360_query_array:
print("query being processed is " + query )
if "270348" in query or "269756" in query:
wait_time = 300
else:
wait_time = 15
driver.get(query)
print("Page wait time is " + str(wait_time))
driver.implicitly_wait(300000)
#print(driver.page_source)
if logged_in !="yes":
google_login(query,email_login,email_password) #This function logs into google account
print("Sleeping 200 seconds")
time.sleep(200)
logged_in = "yes"
#time.sleep(200)
print("reading HTML")
#print(driver.page_source)
read_web = pd.read_html(driver.page_source)#The error occurs on this line
What is that error referring too?那个错误也指的是什么?
This error message...这个错误信息...
WebDriverException: Message: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://marionette/content/proxy.js :: sendReply_ :: line 276" data: no]
...implies that the Marionette threw an error while attempting to read/store/copy the page_source()
. ...暗示Marionette在尝试读取/存储/复制page_source()
抛出错误。
The relevant HTML DOM / DOM Tree would have helped us to debug the issue in a better way.相关的HTML DOM / DOM Tree可以帮助我们以更好的方式调试问题。 However it seems the issue is with the fact that the page_source()
is emencely huge/large which exceeds the max value of the max value Marionette can handle.然而,问题似乎在于page_source()
非常巨大/大,超过了Marionette可以处理的最大值的最大值。 Possibly it's a much bigger string
you're dealing with.可能这是您正在处理的更大的string
。
A quick solution will be to avoid passing the page_source()
to the variable and print it to find out where the actual issue lies.一个快速的解决方案是避免将page_source()
传递给变量并打印它以找出实际问题所在。
print(driver.page_source)
Another aspect to look after would be pd.read_html()
which I am quite not sure.要照顾的另一个方面是pd.read_html()
,我不太确定。
You can find a couple of relevant discussion in:您可以在以下位置找到一些相关讨论:
Documentation links:文档链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.