How to set Google Chrome in WebDriver

前端 未结 6 1915
庸人自扰
庸人自扰 2020-12-10 11:43

I am trying to set Chrome as my browser for testing with Web-Driver and set the chromedriver.exe file properly but I am still getting the following error:

or         


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 12:15

    For Mac -Chrome browser

    public class MultipleBrowser {
    
        public WebDriver driver= null;
        String browser="mozilla";
        String url="https://www.omnicard.com";
    
        @BeforeMethod
        public void LaunchBrowser() {
    
          if(browser.equalsIgnoreCase("mozilla"))
              driver= new FirefoxDriver();
          else if(browser.equalsIgnoreCase("safari"))
              driver= new SafariDriver();
          else if(browser.equalsIgnoreCase("chrome"))
              System.setProperty("webdriver.chrome.driver","/Users/mhossain/Desktop/chromedriver");
              driver= new ChromeDriver();   
              driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);
              driver.navigate().to(url);
              //driver.manage().deleteAllCookies();
    
      }
    

提交回复
热议问题