Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

selenium rotate user agent

from selenium import webdriver

driver = webdriver.Chrome(executable_path=r'C:WebDriverschromedriver.exe')
print(driver.execute_script("return navigator.userAgent;"))
# Setting user agent as Chrome/83.0.4103.97
driver.execute_cdp_cmd('Network.setUserAgentOverride', {"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'})
print(driver.execute_script("return navigator.userAgent;"))
# Setting user agent as Chrome/83.0.4103.53
driver.execute_cdp_cmd('Network.setUserAgentOverride', {"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36'})
print(driver.execute_script("return navigator.userAgent;"))
driver.get('https://www.httpbin.org/headers')
Comment

PREVIOUS NEXT
Code Example
Python :: how to nest try/except statements 
Python :: 16. count total numbers of uppercase and lowercase characters in input string python 
Python :: godot knockback 
Python :: check if string is palindrome using recursion in python 
Python :: NumPy bitwise_or Code When inputs are arrays 
Python :: NumPy packbits Syntax 
Python :: pymenu example 
Python :: django check for empty onetoone exists 
Python :: change admin password djano 
Python :: enumerate and looping backward 
Python :: how to calculate iqr in pandas 
Python :: Use PIP from inside script 
Python :: bouton 
Python :: QDateEdit.date().toString("MMMM dd, yyyy") does not display months in English 
Python :: lda from scratch implementation on iris python 
Python :: map reduce and filter functions in python 
Python :: what does scalar.fit do 
Python :: phlib examples python 
Python :: Flask_SQLAlchemy is claiming my value is not boolean 
Python :: if space bar pressed pygame 
Python :: find middle permutation of the string in python list 
Python :: knn.score sklearn 
Python :: ring retrieves the list of all algorithms supported by Encrypt()/Decrypt() functions. 
Python :: ring Type Hints Library 
Python :: Use miraculous with enviroment variable token 
Python :: Use of OfficeApi 
Python :: sympy.diff 
Python :: create new column pandas and order sequence 
Python :: pls help i need tkintwr help plspslspslspsl help tkinter 
Python :: vaibhav=complex(2,5) 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =