How to get Firefox working with Selenium WebDriver on Mac OSX

前端 未结 8 1603
慢半拍i
慢半拍i 2020-12-14 03:12

I am trying to config proxy settings for the WebDriver so I have used the following code ....

FirefoxProfile profile = new FirefoxProfile();
pro         


        
相关标签:
8条回答
  • 2020-12-14 03:45

    For Mac, if you installed FireFox via brew cask, just symbolic link it to /Applications.

    cd /Applications
    ln -s /Users/<your-username>/Applications/Firefox.app Firefox.app
    

    This worked for me.

    0 讨论(0)
  • 2020-12-14 03:45

    This kind of issue obtained because of selenium web driver fail to find the .exe files of Firefox. Please check whether C:\Program Files (x86)\Mozilla Firefox you have exe file in the location and don’t forget to set environment variable having the java jdk path. Source:- http://www.tech4crack.com/solved-cannot-find-firefox-binary-in-path/

    0 讨论(0)
  • 2020-12-14 03:49

    For Mac:

    1. Use selenium jar 2.44.0 (make sure selenium server jar is 2.44.0)
    2. firefox version 33 (https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/mac/en-US/)
    3. In terminal of Mac, Use this command to create profile for firefox : "/Applications/Firefox.app/Contents/MacOS/firefox-bin" -p

      1. while creating the profile, you would see the path of profile with .default, - make note of this for entering the same in code for profile path.

      2. Code would look like this:

    String profilePath="/Users/admin/Library/ApplicationSupport/Firefox/Profiles/4duhjf19.default";

                    System.out.println("profilePath: "+profilePath);
                    File checkProfile = new File(profilePath);
                    File[] allFolder = checkProfile.listFiles();
                    for (int i = 0; i < allFolder.length; i++) {
    
                        if (allFolder[i].getName().endsWith(".default")) {
                            profilePath = profilePath + allFolder[i].getName();
                            break;
                        }
                    }
    FirefoxProfile firefoxprofile1 = new FirefoxProfile(new File(
                            profilePath));
                    System.out.println("profile path : " + firefoxprofile1);
                    driver = new FirefoxDriver(firefoxprofile1);
                    System.out.println("webdriver FF");
                    driver.manage().deleteAllCookies();
    
    0 讨论(0)
  • 2020-12-14 03:52

    I believe you have several options:

    Either specify the folder (in which your Firefox binary is) in your PATH system variable - here's how.

    Or call

    WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("path/to/your/firefox.exe")), profile);
    
    0 讨论(0)
  • 2020-12-14 03:56

    I'm not sure about on a Mac, but on Windows I resolved this issue.

    Make sure you are using the 32 bit version of nunit. Firefox is a 32 bit browser.

    I have a 64 bit windows OS, but Firefox is a 32 bit browser. I was trying to use the 64 bit version of nunit, which was giving this "Cannot fine firefox binary in PATH" error. I resolved this by using the 32 bit version of nunit. Basically, there are two exe files in the nunit folder, nunit.exe and nunit-x86.exe. If you are getting this "Cannot fine firefox binary in PATH" error, most likely you need to use the 32 bit version of nunit - the Nunit-x86.exe.

    0 讨论(0)
  • 2020-12-14 03:58

    In my case I need to move Firefox.app from /Users/username/Applications to /Applications

    0 讨论(0)
提交回复
热议问题