How to launch browsers using Python-Selenium?

0 votes
May 24 in Selenium by Nikita
17 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hey Nikita, to launch browser in Python-Selenium, you can use these lines of code:

  1. For Chrome Browser: 
    driver = webdriver.Chrome("C:\\Users\\Anvi_R\\Downloads\\chromedriver_win32\\chromedriver.exe")
    
    drv.implicitly_wait(2)
    drv.maximize_window()
    driver.get('https://www.google.com')
  2. For Firefox Browser:

    drv = webdriver.Firefox(executable_path=r"C:\Users\Anvi_R\Downloads\geckodriver-v0.24.0-win64\geckodriver.exe")
    drv.implicitly_wait(2)
    drv.maximize_window()
    drv.get(r"https://www.google.com")
  3. For Internet Explorer Browser:

    drv = webdriver.Ie(r"C:\Users\Anvi_R\Downloads\IEDriverServer_x64_3.14.0\IEDriverServer.exe")
    drv.implicitly_wait(2)
    drv.maximize_window()
    drv.get(r"https://www.google.com")

Note that for Firefox browser, if we execute the script without "executable_path", it gives an "NotADirectoryError". As Selenium client bindings tries to locate the geckodriver executable from the system PATH. So, we need to pass the Key "executable_path" along with the value referring to the absolute path of the GeckoDriver.

answered May 24 by Anvi
• 8,840 points

Related Questions In Selenium

0 votes
1 answer

How to upload a resume to a website using selenium in python?

Use this code, this will help you: from ...READ MORE

answered Apr 20, 2018 in Selenium by Vardy
• 2,280 points
1,000 views
0 votes
1 answer

How to login a forum using Selenium with Python

You should try to directly log in ...READ MORE

answered Apr 27, 2018 in Selenium by Samarpit
• 5,130 points
208 views
0 votes
1 answer

How to Check if any alert exists in selenium using Python

This might work for you. It did ...READ MORE

answered May 10, 2018 in Selenium by king_kenny
• 3,590 points
2,689 views
0 votes
2 answers

How to get HTML Source of WebElement in Selenium WebDriver using Python?

You can read innerHTML attribute to get source of ...READ MORE

answered Jun 13, 2018 in Selenium by Samarpit
• 5,130 points
9,595 views
0 votes
1 answer

How to Hover using Mouse in python using Webdriver

from selenium.webdriver.common.action_chains import ActionChains def hover(self): ...READ MORE

answered Aug 8, 2018 in Selenium by Meci Matt
• 9,400 points
253 views
0 votes
1 answer
0 votes
1 answer

How to mouse hover on a web element using Selenium WebDriver?

Hello Nitin, to automate mouse hovering over ...READ MORE

answered May 7 in Selenium by Anvi
• 8,840 points
31 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.