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

后端 未结 2 1898
无人及你
无人及你 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");
    }
    
    
    0 讨论(0)
  • 2020-12-22 06:42

    My guess - Exactly what the error says, the driver is not executable. SSH into the server and see if

    sudo chmod 777 /var/lib/jenkins/workspace/TravelCenterSeleniumJenkinsIntegrationCMB/target/classes/chromedriver
    

    fixes it (777 grants read/ write/ execute permissions to a file for user, group, and others respectively). If you can't SSH in whatever provisions your Jenkins server probably needs to make the file executable on on startup

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