【发布时间】:2019-10-23 13:23:26
【问题描述】:
当我使用 Selenium 运行 googletag 参数时,我试图从浏览器的控制台中获得一些响应,但不幸的是我没有。
我已经尝试过使用 .execute_async_script('googletag.pubads()') 以及将所有内容都放在 try/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()')
我希望浏览器检查中的控制台会向我显示信息,但它没有显示任何内容。
【问题讨论】:
标签: javascript python-3.x selenium