Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

How to prevent a website to detect that i am using Selenium WebDriver ?

Hello everyone, i have seen someone ask this question on stackeroverflow but it has been a while and the answers have been really mixed, so I would like to know from you guys what you think.

I have noticed that every time that i open the Chromedriver using Selenium,even though I do navigate myself using my mouse and keyboard after opening it (so there is no automation at all) I get really really complicated captchas on Websites that use them . I am talking about Captchas that last about 2 minutes.
When i open chrome manually there is no problem, i can get captchas sometimes but they are really easy to solve (generally ten seconds or less for me).
The only thing that changes is that i use selenium to open the chromedriver.
Does the fact that you open the Chromedriver via Selenium instead of opening it manually tell the website that you are using an automation software?
If yes, is there a way to "hide" that you are using Selenium in order to get "normal" captchas?-
(Jul 7, 2019 07:39 AM)chillmaster8 Wrote:  Hello everyone, i have seen someone ask this question on stackeroverflow but it has been a while and the answers have been really mixed, so I would like to know from you guys what you think.

I have noticed that every time that i open the Chromedriver using Selenium,even though I do navigate myself using my mouse and keyboard after opening it (so there is no automation at all) I get really really complicated captchas on Websites that use them . I am talking about Captchas that last about 2 minutes.
When i open chrome manually there is no problem, i can get captchas sometimes but they are really easy to solve (generally ten seconds or less for me).
The only thing that changes is that i use selenium to open the chromedriver.
Does the fact that you open the Chromedriver via Selenium instead of opening it manually tell the website that you are using an automation software?
If yes, is there a way to "hide" that you are using Selenium in order to get "normal" captchas?-

There is no way in Selenium to read the request or response headers. You could do it by instructing your browser to connect through a proxy that records this kind of information.

Setting the User Agent in Firefox


The usual way to change the user agent for Firefox is to set the variable "general.useragent.override" in your Firefox profile. Note that this is independent from Selenium.

You can direct Selenium to use a profile different from the default one, like this:

from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("general.useragent.override", "whatever you want")
driver = webdriver.Firefox(profile)

Setting the User Agent in Chrome

With Chrome, what you want to do is use the user-agent command line option. Again, this is not a Selenium thing. You can invoke Chrome at the command line with chrome --user-agent=foo to set the agent to the value foo.

With Selenium you set it like this:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("user-agent=whatever you want")

driver = webdriver.Chrome(chrome_options=opts)

Both methods above were tested and found to work. I don't know about other browsers.

Getting the User Agent

Selenium does not have methods to query the user agent from an instance of WebDriver. Even in the case of Firefox, you cannot discover the default user agent by checking what general.useragent.override would be if not set to a custom value. (This setting does not exist before it is set to some value.)

Once the browser is started, however, you can get the user agent by executing:

agent = driver.execute_script("return navigator.userAgent")

The agent variable will contain the user agent.


Per - https://stackoverflow.com/questions/2991...ium-driver
(Jul 7, 2019 07:43 AM)HSGM Wrote:  There is no way in Selenium to read the request or response headers. You could do it by instructing your browser to connect through a proxy that records this kind of information.

Setting the User Agent in Firefox


The usual way to change the user agent for Firefox is to set the variable "general.useragent.override" in your Firefox profile. Note that this is independent from Selenium.

You can direct Selenium to use a profile different from the default one, like this:

from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("general.useragent.override", "whatever you want")
driver = webdriver.Firefox(profile)

Setting the User Agent in Chrome

With Chrome, what you want to do is use the user-agent command line option. Again, this is not a Selenium thing. You can invoke Chrome at the command line with chrome --user-agent=foo to set the agent to the value foo.

With Selenium you set it like this:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("user-agent=whatever you want")

driver = webdriver.Chrome(chrome_options=opts)

Both methods above were tested and found to work. I don't know about other browsers.

Getting the User Agent

Selenium does not have methods to query the user agent from an instance of WebDriver. Even in the case of Firefox, you cannot discover the default user agent by checking what general.useragent.override would be if not set to a custom value. (This setting does not exist before it is set to some value.)

Once the browser is started, however, you can get the user agent by executing:

agent = driver.execute_script("return navigator.userAgent")

The agent variable will contain the user agent.

Hello,
does this mean that google knows that i am using Selenium through my user agemt ?
Because when I tried to check my user agent it was the same with and without selenium
(Jul 7, 2019 08:51 AM)chillmaster8 Wrote:  Hello,
does this mean that google knows that i am using Selenium through my user agemt ?
Because when I tried to check my user agent it was the same with and without selenium

https://www.google.com/search?q=what+is+my+useragent ❓

Have you even ran a search on google.com?
(Jul 7, 2019 01:26 PM)VoIPv2 Wrote:  Have you even ran a search on google.com?

Have you even understood my question?
I already know how to check my user agent, it doesn't help to answer my question tho 😠
thanx! needed this for my website!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by ekipaMar 26, 2020 12:21 PM 1 104 Mar 26, 2020 12:21 PM
Last Post: idklolkillme
by somenormalguyAug 18, 2019 06:55 AM 0 84 Aug 18, 2019 06:55 AM
Last Post: somenormalguy
by TurfDec 4, 2018 09:26 PM 5 189 Dec 4, 2018 09:26 PM
Last Post: realsunjester