简体   繁体   English

Python Selenium 再次使用Chromedriver

[英]Python Selenium use Chromedriver again

So i did this for a Python Selenium Projekt:所以我为 Python Selenium 项目做了这个:

You can do this by providing your chrome profile to the selenium.您可以通过向 selenium 提供您的 chrome 配置文件来做到这一点。

First type this into your chrome address bar chrome://version/ and copy the profile path.首先将其输入您的 chrome 地址栏 chrome://version/ 并复制配置文件路径。

Note:- Remove the Default from the path ie if the path is /home/aditya/.config/google-chrome/Default then after removing the Default, the path will be /home/aditya/.config/google-chrome注意:- 从路径中删除默认值,即如果路径为 /home/aditya/.config/google-chrome/Default,则在删除默认值后,路径将为 /home/aditya/.config/google-chrome

then paste the profile path into the following code:-然后将配置文件路径粘贴到以下代码中:-

options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=/home/aditya/.config/google-chrome") # profile path
driver = webdriver.Chrome(chrome_options=options)
driver.get("https://www.google.com")

Now i want to undo this i reinstalled Selenium and tried some other things but nothing worked?现在我想撤消这个我重新安装了 Selenium 并尝试了一些其他的东西但没有任何效果? Can anyone help?谁能帮忙?

Just erase the text you pasted there, you're configuring the Chromedriver to behave like a certain version of Chromium, so if you remove the line that is configuring it to do so, it will not longer do so.只需擦除您粘贴在那里的文本,您正在将 Chromedriver 配置为像特定版本的 Chromium 一样运行,因此如果您删除配置它的行,它将不再这样做。 You are not permanently modifying the driver.您不是在永久修改驱动程序。

EDIT: THIS was the link that solved his problem.编辑: 是解决他的问题的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM