Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.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
Javascript 尝试执行驱动程序时没有回答。执行_脚本(gooogletag_Javascript_Python 3.x_Selenium - Fatal编程技术网

Javascript 尝试执行驱动程序时没有回答。执行_脚本(gooogletag

Javascript 尝试执行驱动程序时没有回答。执行_脚本(gooogletag,javascript,python-3.x,selenium,Javascript,Python 3.x,Selenium,当我使用Selenium运行googletag参数时,我试图从浏览器的控制台中获得一些响应,但不幸的是,我没有 我已经尝试了.execute\u async\u script('googletag.pubads()')以及将所有内容放入try/execute中,但即使我没有得到任何回复,也不会调用execute 这是我的代码: from selenium import webdriver from selenium.webdriver.common.desired_capabilities im

当我使用Selenium运行googletag参数时,我试图从浏览器的控制台中获得一些响应,但不幸的是,我没有

我已经尝试了
.execute\u async\u script('googletag.pubads()')
以及将所有内容放入try/execute中,但即使我没有得到任何回复,也不会调用execute

这是我的代码:

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

url = 'https://joursferies.fr'

d = DesiredCapabilities.CHROME
d['loggingPrefs'] = { 'browser':'ALL' }
browser = webdriver.Chrome(desired_capabilities=d)
browser.get(url)
browser.execute_script('googletag.openConsole()')

# Until here everything is perfect but with the following line is when I never get any answer:

browser.execute_script('googletag.pubads()')

我希望浏览器Inspect中的控制台会向我显示信息,但它不会显示任何内容。

尝试添加return,
Browser.execute\u脚本('return googletag.openConsole()')
尝试添加return,
Browser.execute\u脚本('return googletag.openConsole()'))

@error404如果此答案有助于您投票或为了未来读者的利益接受答案。请参阅:@error404如果此答案有助于您投票或为了未来读者的利益接受答案。请参阅: