Home > Back-end >  How to hide pyhon selenium works for browser
How to hide pyhon selenium works for browser

Time:02-05

when a try to use a python Selenium, browser detect that this is a parser and i have not posibility to work with page. i can not get a page fully to make click() and other func.

!!! Fake-user-agent does not work

or pls suggest other methot to make a click on the page, for start video-player and get a link of button that located inside this player. i only need this link that always different that is link to download a video (JW player 8.26.5 )

CodePudding user response:

You would need to bypass the detection by the website that you're using Selenium.

One way is using --disable-blink-features=AutomationControlled option when starting the browser. This tells the browser to not use the default user agent string, which is typically set to indicate that the browser is being controlled by automation software like Selenium.

Here is an example with chrome:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--disable-blink-features=AutomationControlled")
driver = webdriver.Chrome(options=options)
driver.get("YOUR_URL")

You may also need to set a custom user-agent string to further disguise your browser as a non-automated user:

options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36")
  • Related