Driver is not executable error in Jenkins but its running in Local Machine (MacBook)

后端 未结 2 1914
无人及你
无人及你 2020-12-22 05:58

I am working on MacBook. Our Jenkins server is running in linux server when I running tests via testing.xml file all test classes are running but when I run Jenkins

2条回答
  •  感动是毒
    2020-12-22 06:41

    public static String osDetector() {
      String os = System.getProperty("os.name").toLowercase();
      if (os.contains("win") {
        return Windows;
      } else if(os.contains("nux") || os.contains("nix") {
        return Linux;
      } else {
        return "OtherOs";
      }
    }
    
    // under the openDriverMethod
    ChromeOptions options = new ChromeOptions();
    if (osDetector.contains("Windows") {
      System.setProperty("webdriver.chrome.driver", "driver folder path");
    } else if(osDetector.contains("Linux") {
      System.setProperty("webdriver.chrome.driver", "driver folder path");
      //you need to add this one i guess!
      options.setBinary("/usr/bin/google-chrome");
    }
    
    

提交回复
热议问题