简体   繁体   中英

Browser not opening using Selenium webdriver

Here is the error:

[11762:11762:0801/141204:ERROR:url_pattern_set.cc(240)] Invalid url pattern: chrome://print/* getrlimit(RLIMIT_NOFILE) failed [11762:11886:0801/141205:ERROR:get_updates_processor.cc(243)] PostClientToServerMessage() failed during GetUpdates getrlimit(RLIMIT_NOFILE) failed

Code :

public class FirstTestCase { 
  public static void main(String[] args) throws InterruptedException {  
   // TODO Auto-generated method stub
   System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome"); 
   WebDriver driver = new ChromeDriver(); 
   String URL = "mail.google.com";;

There are two problem in your provided code :-

  • You are setting webdriver.chrome.driver with installed chrome location which wrong . you need to download latest chrome driver zip from here and put at any location in your machine and extract that zip and set found chromedriver to the system property with variable webdriver.chrome.driver .

  • You are providing wrong URL to launch, You should provide URL with http:// or https:// .

So the working example are as below :-

public class FirstTestCase { 
  public static void main(String[] args) throws InterruptedException {  
   System.setProperty("webdriver.chrome.driver", "path/to/downloaded chromedriver"); 
   WebDriver driver = new ChromeDriver(); 
   String URL = "https://www.google.com";
   driver.get(URL);
  }
}

Hope it works..:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM