I have been attempting to receive responses in the console from the browser when running googletag parameters with Selenium, but unfortunately I have not been successful.
Even after trying
.execute_async_script('googletag.pubads()')
and putting everything within a try/execute block, the execute function is not being triggered, even without any response.
Here's my code:
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()')
# Everything works fine up to this point, but the following line never returns any response:
browser.execute_script('googletag.pubads()')
I was expecting to see information in the Console of the Browser Inspector, but nothing is displayed.