Tuesday, January 1, 2013

Chrome browser + Selenium issue.

I tried to automate the chrome browser with selenium. I just need to open the chrome browser, go to google.com, enter "land" on search box, press search and check the browser title.

Here is my code:
System.setProperty("webdriver.chrome.driver", 
           "/media/partition1/QA/selenium_automation/chromedriver");
WebDriver driver1 = new ChromeDriver();

driver1.get("http://www.google.com");
WebElement element1 = driver1.findElement(By.name("q"));
element1.sendKeys("land");
element1.submit();
System.out.println("Page title is: " + driver1.getTitle());
(new WebDriverWait(driver1, 10)).until(new ExpectedCondition() {
    public Boolean apply(WebDriver input) {
         return input.getTitle().toLowerCase().startsWith("land");
    }
});
System.out.println("Page title is: " + driver1.getTitle());
driver1.quit();

How ever when im running this i got an exception. This is the important part of it.

/opt/google/chrome/google-chrome: /lib/libz.so.1: no version information available (required by /opt/google/chrome/google-chrome)
/opt/google/chrome/google-chrome: /lib/libz.so.1: no version information available (required by /opt/google/chrome/google-chrome)
/opt/google/chrome/chrome: /lib/libz.so.1: no version information available (required by /opt/google/chrome/chrome)
/opt/google/chrome/chrome: /lib/libz.so.1: no version information available (required by /opt/google/chrome/chrome)
/opt/google/chrome/nacl_helper: /lib/libz.so.1: no version information available (required by /opt/google/chrome/nacl_helper)

I just see the browser opens and suddenly disappears. I checked my chrome version. It was 17. But the current stable version is 23. So I installed the new version. It resolved my issue.

No comments: