I want to use Selenium Webdriver of Chrome in colab.research.google.com for fast processing. I was able to install Selenium using !pip install selenium
but the webdriver of chrome needs a path to webdriverChrome.exe. How am I suppose to use it?
P.S.- colab.research.google.com is an online platform which provides GPU for fast computational problems related to deep learning. Please refrain from solutions such as webdriver.Chrome(path).
We can click on Google search with Selenium webdriver. First of all we need to identify the search edit box with help of any of the locators like id, class,name, xpath or css. Then we will input some text with the sendKeys() method.
Selenium WebDriver is a web framework that permits you to execute cross-browser tests. This tool is used for automating web-based application testing to verify that it performs expectedly. Selenium WebDriver allows you to choose a programming language to create test scripts.
We've seen in past how to install and run Selenium with Python, in this guide we will try to do the same in Jupyter Notebook on WSL2. The instructions should be same for both WSL2 and Ubuntu.
You can do it by installing the chromium webdriver and adjusting some options such that it does not crash in google colab:
!pip install selenium !apt-get update # to update ubuntu to correctly run apt install !apt install chromium-chromedriver !cp /usr/lib/chromium-browser/chromedriver /usr/bin import sys sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options) wd.get("https://www.webite-url.com")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With