Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Selenium Webdriver中使用无头Chrome时避免自我XSS警告_Python_Selenium_Selenium Webdriver_Google Chrome Headless - Fatal编程技术网

Python 在Selenium Webdriver中使用无头Chrome时避免自我XSS警告

Python 在Selenium Webdriver中使用无头Chrome时避免自我XSS警告,python,selenium,selenium-webdriver,google-chrome-headless,Python,Selenium,Selenium Webdriver,Google Chrome Headless,我正试图用无头Chrome打开一个网页进行网页抓取,但我收到了一个自我XSS警告,该网页无法检索 此错误发生在“获取”阶段,在我实际尝试执行页面上的任何脚本之前: [0527/071700.434:INFO:CONSOLE(505)] "%c%s color: red; background: yellow; font-size: 24px; WARNING!", source: /_/mss/boq-identity/_/js/k=boq-identity.ConsentU

我正试图用无头Chrome打开一个网页进行网页抓取,但我收到了一个自我XSS警告,该网页无法检索

此错误发生在“获取”阶段,在我实际尝试执行页面上的任何脚本之前:

[0527/071700.434:INFO:CONSOLE(505)] "%c%s color: red; background: yellow; font-size: 24px; WARNING!", source: /_/mss/boq-identity/_/js/k=boq-identity.ConsentUi.en_GB.VucJXlAkXyo.es5.O/am=CwAQ/d=1/excm=_b,_tp,mainview/ed=1/dg=0/wt=2/rs=AOaEmlECz_87YTuhKKwEvkQJQGH1ukQd8w/m=_b,_tp (505)
[0527/071700.434:INFO:CONSOLE(505)] "%c%s font-size: 18px; Using this console may allow attackers to impersonate you and steal your information using an attack called Self-XSS.
Do not enter or paste code that you don't understand.", source: /_/mss/boq-identity/_/js/k=boq-identity.ConsentUi.en_GB.VucJXlAkXyo.es5.O/am=CwAQ/d=1/excm=_b,_tp,mainview/ed=1/dg=0/wt=2/rs=AOaEmlECz_87YTuhKKwEvkQJQGH1ukQd8w/m=_b,_tp (505)
如果我使用webdriver打开GUI,页面会很好地打开

我曾尝试使用其他指南和答案建议的标志来避免这种情况(许多人建议禁用xss auditor),但这并没有帮助。我尝试过手动设置可执行路径,而不是使用ChromeDriverManager,但这也没有改变任何事情

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--disable-gpu")
    chrome_options.add_argument("--disable-xss-auditor")
    driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(),options=chrome_options)
    time.sleep(1)
    driver.get(page_url)