-2

Good Morning Everyone. Below the automation code in selenium with python. It was working previously in past OS- ubuntu. I have installed the new Mint Linux, installed the pycharm and downloaded the code from Github. First time it is downloading the chrome driver and it gives the error. Second time it is giving this error.

code:-

import time
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
s = Service(ChromeDriverManager().install())
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
#browser = webdriver.Chrome(executable_path='/usr/bin/chromedriver', options=chrome_options, service_args=['--verbose', '--log-path=/tmp/chromedriver.log'])
browser = webdriver.Chrome(service=s, options=chrome_options)
#browser = webdriver.Chrome(options=Options)
browser.implicitly_wait(5)

"""
Going to use drag and drop 
get the details from the mouse hover details

"""
browser.get("https://www.rahulshettyacademy.com/AutomationPractice")
browser.maximize_window()
print(browser.title)
#//a[normalize-space()='Top']
#//button[@id='mousehover']
action = ActionChains(browser)

Error Message:-
/home/halovivek/PycharmProjects/yearcoding/venv/bin/python /home/halovivek/PycharmProjects/yearcoding/22092022_selenium1.py 
Traceback (most recent call last):
  File "/home/halovivek/PycharmProjects/yearcoding/22092022_selenium1.py", line 16, in <module>
    browser = webdriver.Chrome(service=s, options=chrome_options)
  File "/home/halovivek/PycharmProjects/yearcoding/venv/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/home/halovivek/PycharmProjects/yearcoding/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/home/halovivek/PycharmProjects/yearcoding/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 270, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/halovivek/PycharmProjects/yearcoding/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 363, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/halovivek/PycharmProjects/yearcoding/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 428, in execute
    self.error_handler.check_response(response)
  File "/home/halovivek/PycharmProjects/yearcoding/venv/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
Stacktrace:
#0 0x555ab50bc693 <unknown>
#1 0x555ab4eb5b0a <unknown>
#2 0x555ab4ed846e <unknown>
#3 0x555ab4ed61f4 <unknown>
#4 0x555ab4f11953 <unknown>
#5 0x555ab4f0b743 <unknown>
#6 0x555ab4ee1533 <unknown>
#7 0x555ab4ee2715 <unknown>
#8 0x555ab510c7bd <unknown>
#9 0x555ab510fbf9 <unknown>
#10 0x555ab50f1f2e <unknown>
#11 0x555ab51109b3 <unknown>
#12 0x555ab50e5e4f <unknown>
#13 0x555ab512fea8 <unknown>
#14 0x555ab5130052 <unknown>
#15 0x555ab514a71f <unknown>
#16 0x7f2b51a711da <unknown>
#17 0x7f2b51af9d84 <unknown>


Process finished with exit code 1

I dont know why this suddenly happening. I need solution to continue my learning and writing the code. Thank you.

vivek rajagopalan
  • 843
  • 3
  • 13
  • 22

1 Answers1

0

Good day Ahead. Since I could not able to find the solution. I just reinstalled the whole operating system. I installed Ubuntu again from Linux Mint. Now the code is working fine. thank you

vivek rajagopalan
  • 843
  • 3
  • 13
  • 22