
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get Firefox Working with Selenium WebDriver on Mac OSX
We can get Firefox working with Selenium webdriver on Mac OS. For Firefox versions which are greater than 47, the geckodriver.exe file is to be used. We shall be able to launch the browser only after creating an object of the FirefoxDriver class.
Syntax
WebDriver driver=new FirefoxDriver();
Visit the link − https://www.selenium.dev/downloads/ and go to the Browser segment. Click on the Documentation link below Firefox.
In the Supported platforms page, click on geckodriver releases link.
Then click on the link corresponding to Mac OS.
Once downloaded, extract the file and save the geckodriver.exe file to the /usr/local/bin location. As in Windows, we do not need to configure any path of the file in Mac.
Example
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; public class FirefoxOnMac{ public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS); driver.get("https://www.tutorialspoint.com/index.htm"); driver.quit(); } }
Advertisements