myshell-ai / AIlice

AIlice is a fully autonomous, general-purpose AI agent.
MIT License
837 stars 134 forks source link

Use Playwright instead of Selenium in AWebBrowser.py for easier chrome driver instalation? #58

Open jechaviz opened 2 months ago

jechaviz commented 2 months ago

With playwrite is easier chrome driver updates and instalation. It's just a matter of "playwright install" Check it out. https://www.zenrows.com/blog/playwright-vs-selenium

jechaviz commented 2 months ago

Or use webdriver_manager in your project: pip install webdriver_manager

Use it in your script: Instead of manually specifying the path to the ChromeDriver, you can use webdriver_manager to handle it.

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

# Setup ChromeDriver with webdriver_manager
driver = webdriver.Chrome(ChromeDriverManager().install())
stevenlu137 commented 2 months ago

Thank you for the information! This is indeed the first time I've heard about the Playwright option. I will look into this library and see if we can implement a better browser module.

However, I'd like to know more about the specific issue you encountered. Currently, the implementation of the browser module does consider the installation of chromedriver. According to this source (https://www.selenium.dev/documentation/selenium_manager/), Selenium is already capable of automatically managing the installation and maintenance of chromedriver (although it is still in the beta version). If there's a problem with chromedriver, it would be helpful to understand the environmental conditions under which it occurred.