abjer / isds2020

Introduction to Social Data Science 2020 - a summer school course abjer.github.io/isds2020
58 stars 92 forks source link

Selenium - log #48

Closed Emilkj closed 3 years ago

Emilkj commented 3 years ago

We are using the following packages for selenium:

from seleniumrequests import Chrome
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
import time

And starting the driver like this:

driver = Chrome(ChromeDriverManager().install())
driver.get(url)

and requests like this in the end:

response = driver.request('GET', 'URL  with api')

I'm not quite sure how to use the connector for logging for selenium, but it's working for everything else.

Can anybody clarify?

emilblicher commented 3 years ago

In your driver, just add service_log_path = 'log.txt' as:

driver = Chrome(ChromeDriverManager().install(), service_log_path = 'log.txt')
Emilkj commented 3 years ago

Thank you. So we do not need the connector for selenium, as long as we log and use enough time.sleep()?

Emilkj commented 3 years ago

I got a reply from Andreas. We can log in different ways, so the above is perfect. Thank you.