0
from selenium.webdriver import Chrome

browser= Chrome("C://Users/Debasis/Downloads/chromedriver.exe")

but I get error:

C:\Users\Debasis\PycharmProjects\application\venv\Scripts\python.exe C:/Users/Debasis/PycharmProjects/application/myteam/firsttest.py
Traceback (most recent call last):
  File "C:/Users/Debasis/PycharmProjects/application/myteam/firsttest.py", line 1, in <module>
    from selenium.webdriver import Chrome
ImportError: cannot import name 'Chrome'

even firefox also. can you please help out . how to resolve the problem?

ᴀʀᴍᴀɴ
  • 4,443
  • 8
  • 37
  • 57
  • Have you downloaded the webdriver extensions for chrome or firefox? Check out this post: https://stackoverflow.com/questions/42478591/python-selenium-chrome-webdriver – Matthew Story Jul 07 '18 at 10:23
  • Yes everything done from my side. i am using current version of python and IDE pycharm. – Bachhu Nandi Jul 07 '18 at 10:39

1 Answers1

0
Try:        
    from selenium import webdriver
    chromedriver = "D:/SeleniumDrivers/chromedriver_34.exe"
    os.environ["webdriver.chrome.driver"] = chromedriver

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--start-maximized")

    #self.driver = webdriver.Chrome(chromedriver)
    self.driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=chrome_options)

or
#If using remote webdriver
#capability = DesiredCapabilities.CHROME;
#capability.setBrowserName("chrome");
chromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
desiredcapabilities={'browserName': 'chrome', 'executable_path': chromePath}
self.driver = webdriver.Remote("http://127.0.0.1:4444/wd/hub", desired_capabilities=desiredcapabilities)#, "ANY")
Deepak Garud
  • 977
  • 10
  • 18