Home > Enterprise >  How to use normal chrome completely without chromedriver selenium python not duplicate
How to use normal chrome completely without chromedriver selenium python not duplicate

Time:12-19

How to use normal chrome completely without chromedriver selenium python not duplicate. I am using python 3.8.8,os is windows 7 ultimate with pycharm as IDE and chrome version is around 96. and my problem is that whenever I use my python script to scrape a website it uses chromedriver and when I specify what's given below:

options = Options () 
options.add_argument(r"user-data-dir=my chrome path which is not Executable instead the user data")
#this works but when opening chrome it shows "browser is controlled by automated software" and changing it to normal chrome. Exe won't work

Sure it uses normal chrome with my credentials but it still needs chromedriver to work and when I delete the chromedriver it throw an error and when I go into selenium source code in a file called site.py(or sites.py) which I changed the variable self. executable to chrome.exe path and it worked and it won't show the message browser is controlled by automated software but it won't do anything , it is just stuck there and what I want to do is use chrome as the browser to scrape without chromedriver in my pc is it possible? If yes please tell me how should I go on to do it and you can ask for further Clarification and details and Thanks in advance

CodePudding user response:

By default, selenium is detected as an automated software and is flagged by most websites, and the flag is unable to be removed. There are, however, external libraries that can be installed that can remove the flag.

There are options here to try to get around the default flag and hide the fact the browser is automated.

Edit

I understand the question further, and see that you want a more portable chrome option. Chrome driver is a very specific program controlled by selenium and must be used. There is no substitute. You can use Firefox driver or internet explorer, but a webdriver must be used (hence the name driver for driving the main browser). When you specify the directory for the Chrome binary, you aren’t removing the middleman of the chromedriver, only Specifying where chrome driver needs to look!

CodePudding user response:

Using Selenium you won't be able to initiate/spawn a new Browsing Context i.e. Chrome Browser session without the ChromeDriver.


The Parts and Pieces

As a minimum requirement, the WebDriver i.e the ChromeDriver talks to a browser through a driver and the communication is two way:

  • WebDriver passes commands to the browser through the driver
  • Receives information back via the same route.

Hence using ChromeDriver is a mandatory requirement.

  • Related