<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11938#M6839</link>
    <description>&lt;P&gt;Hi @Prabhakar Jha​&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the clusters library tab, please install&amp;nbsp;&lt;B&gt;PyPi chromedriver-binary==83.0&lt;/B&gt;&amp;nbsp;(or higher, probably version in the script can also be updated)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To cluster init script, please add /databricks/scripts/&lt;A href="https://selenium-install.sh/" alt="https://selenium-install.sh/" target="_blank"&gt;selenium-install.sh&lt;/A&gt;, which you create using the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in the databricks notebook code, please use something similar to the second code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dbutils.fs.mkdirs("dbfs:/databricks/scripts/")
dbutils.fs.put("/databricks/scripts/selenium-install.sh","""
#!/bin/bash
apt-get update
apt-get install chromium-browser=91.0.4472.101-0ubuntu0.18.04.1 --yes
wget &lt;A href="https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_linux64.zip" target="test_blank"&gt;https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_linux64.zip&lt;/A&gt; -O /tmp/chromedriver.zip
mkdir /tmp/chromedriver
unzip /tmp/chromedriver.zip -d /tmp/chromedriver/
""", True)
display(dbutils.fs.ls("dbfs:/databricks/scripts/"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;from selenium import webdriver
chrome_driver = '/tmp/chromedriver/chromedriver'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
# chrome_options.add_argument('--disable-dev-shm-usage') 
chrome_options.add_argument('--homedir=/dbfs/tmp')
chrome_options.add_argument('--user-data-dir=/dbfs/selenium')
# prefs = {"download.default_directory":"/dbfs/tmp",
#          "download.prompt_for_download":False
# }
# chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(executable_path=chrome_driver, options=chrome_options)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2022 08:31:36 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2022-07-29T08:31:36Z</dc:date>
    <item>
      <title>How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11937#M6838</link>
      <description>&lt;P&gt;from selenium import webdriver&lt;/P&gt;&lt;P&gt;from webdriver_manager.chrome import ChromeDriverManager&lt;/P&gt;&lt;P&gt;from selenium.webdriver.common.by import By&lt;/P&gt;&lt;P&gt;from selenium.webdriver.chrome.options import Options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drivers = webdriver.Chrome(ChromeDriverManager().install())&lt;/P&gt;&lt;P&gt;drivers.get("https://www.google.co.in/")&lt;/P&gt;&lt;P&gt;drivers.find_element(By.NAME, "q").send_keys("Prabhakar Kumar Jha")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Error message&lt;/B&gt;&lt;/P&gt;&lt;P&gt;WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/103.0.5060/chromedriver unexpectedly exited. Status code was: 127&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 05:46:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11937#M6838</guid>
      <dc:creator>Prabhakar1</dc:creator>
      <dc:date>2022-07-29T05:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11938#M6839</link>
      <description>&lt;P&gt;Hi @Prabhakar Jha​&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the clusters library tab, please install&amp;nbsp;&lt;B&gt;PyPi chromedriver-binary==83.0&lt;/B&gt;&amp;nbsp;(or higher, probably version in the script can also be updated)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To cluster init script, please add /databricks/scripts/&lt;A href="https://selenium-install.sh/" alt="https://selenium-install.sh/" target="_blank"&gt;selenium-install.sh&lt;/A&gt;, which you create using the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in the databricks notebook code, please use something similar to the second code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dbutils.fs.mkdirs("dbfs:/databricks/scripts/")
dbutils.fs.put("/databricks/scripts/selenium-install.sh","""
#!/bin/bash
apt-get update
apt-get install chromium-browser=91.0.4472.101-0ubuntu0.18.04.1 --yes
wget &lt;A href="https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_linux64.zip" target="test_blank"&gt;https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_linux64.zip&lt;/A&gt; -O /tmp/chromedriver.zip
mkdir /tmp/chromedriver
unzip /tmp/chromedriver.zip -d /tmp/chromedriver/
""", True)
display(dbutils.fs.ls("dbfs:/databricks/scripts/"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;from selenium import webdriver
chrome_driver = '/tmp/chromedriver/chromedriver'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
# chrome_options.add_argument('--disable-dev-shm-usage') 
chrome_options.add_argument('--homedir=/dbfs/tmp')
chrome_options.add_argument('--user-data-dir=/dbfs/selenium')
# prefs = {"download.default_directory":"/dbfs/tmp",
#          "download.prompt_for_download":False
# }
# chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(executable_path=chrome_driver, options=chrome_options)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 08:31:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11938#M6839</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-07-29T08:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11939#M6840</link>
      <description>&lt;P&gt;Hi Hubert, &lt;/P&gt;&lt;P&gt;Resolve that issue, but I got a new issue after this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from selenium import webdriver&lt;/P&gt;&lt;P&gt;chrome_driver = '/tmp/chromedriver/chromedriver'&lt;/P&gt;&lt;P&gt;chrome_options = webdriver.ChromeOptions()&lt;/P&gt;&lt;P&gt;chrome_options.add_argument('--no-sandbox')&lt;/P&gt;&lt;P&gt;chrome_options.add_argument('--headless')&lt;/P&gt;&lt;P&gt;chrome_options.add_argument('--disable-dev-shm-usage')&amp;nbsp;&lt;/P&gt;&lt;P&gt;chrome_options.add_argument('--homedir=/dbfs/tmp')&lt;/P&gt;&lt;P&gt;chrome_options.add_argument('--user-data-dir=/dbfs/selenium')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))&lt;/P&gt;&lt;P&gt;driver.get('https://www.google.com/')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;But the error is:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Message: unknown error: Chrome failed to start: exited abnormally.&lt;/P&gt;&lt;P&gt;  (unknown error: DevToolsActivePort file doesn't exist)&lt;/P&gt;&lt;P&gt;  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 11:31:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11939#M6840</guid>
      <dc:creator>Prabhakar1</dc:creator>
      <dc:date>2022-08-16T11:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11940#M6841</link>
      <description>&lt;P&gt;Hi &lt;A href="https://community.databricks.com/s/profile/0058Y00000BOGFAQA5" alt="https://community.databricks.com/s/profile/0058Y00000BOGFAQA5" target="_blank"&gt;Prabhakar&lt;/A&gt; and @Hubert Dudek​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you find out a solution to your new issue "Message: unknown error: Chrome failed to start: exited abnormally." ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am stuck with the same error. I tried to have selenium works with Databricks but without success.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2022 16:47:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11940#M6841</guid>
      <dc:creator>Olivier_G_</dc:creator>
      <dc:date>2022-09-18T16:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11941#M6842</link>
      <description>&lt;P&gt;Hi, @Prabhakar Jha​&amp;nbsp;​&amp;nbsp;I've created a new version of the selenium with the databricks manual. Please look here &lt;A href="https://community.databricks.com/s/feed/0D58Y00009SWgVuSAL" alt="https://community.databricks.com/s/feed/0D58Y00009SWgVuSAL" target="_blank"&gt;https://community.databricks.com/s/feed/0D58Y00009SWgVuSAL&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 14:26:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11941#M6842</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-11-09T14:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: How Selenium Webdriver works on Azure Databricks? I am unable to run a simple code.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11942#M6843</link>
      <description>&lt;P&gt;I also got that error.  What worked for me was downloading the chrome driver and ensuring its the latest version with shell scripts in the same notebook I used for web scraping. I could not use the web driver manager. You can see all the details here:&amp;nbsp;&lt;A href="https://stackoverflow.com/a/76515841/22103209" alt="https://stackoverflow.com/a/76515841/22103209" target="_blank"&gt;https://stackoverflow.com/questions/69192050/using-selenium-within-databricks-chrome-not-reachable/76515841#76515841&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 15:44:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-selenium-webdriver-works-on-azure-databricks-i-am-unable-to/m-p/11942#M6843</guid>
      <dc:creator>Evan_MCK</dc:creator>
      <dc:date>2023-06-21T15:44:27Z</dc:date>
    </item>
  </channel>
</rss>

