Home > other >  Python selenium
Python selenium

Time:11-11

 import time 
Import the random
The from fake_useragent import UserAgent
The from the selenium import webdriver
The import, the random time
The import threading
The from selenium.webdriver.com mon. Desired_capabilities import DesiredCapabilities
The from fake_useragent import UserAgent

Headers={
'Accept' : 'text/HTML, application/XHTML + XML, application/XML. Q=0.9, image/avif, image/webp image/apng, */*; Q=0.8, application/signed - exchange; V=b3. Q=0.9 ',
'the Accept - Language' : 'useful - CN, useful; Q=0.9 ',
'the user-agent: UserAgent (). The random,
'Connection' : 'keep - the alive',
}



Driver_path=r D: \ "thunderbolt download \ geckodriver v0.27.0 - win64 \ geckodriver exe"

Driver=webdriver. Chrome
Driver=webdriver. Firefox (executable_path=driver_path, desired_capabilities=headers)
# complains

Error:

Is the last line of the code,
If you remove the desired_capabilities can simulate normal visit website, but I want to give it to add some request header, could you tell me how to add to
  • Related