7

I am new to selenium.I am getting some issues while using Selenium WebDriver.

I want to open website using Selenium WebDriver like www.filpkart.com

My Code

package com.screen;


import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;


public class HTMLParseExample {


 public static void main(String[] args) {

      WebDriver driver = new FirefoxDriver();


      //Launch website
      driver.get("http://www.flipkart.com");
      driver.close();


   }
  }

I am facing This Error mentioned below.

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V
at org.openqa.selenium.firefox.internal.ClasspathExtension.writeTo(ClasspathExtension.java:60)
at org.openqa.selenium.firefox.FirefoxProfile.installExtensions(FirefoxProfile.java:504)
at org.openqa.selenium.firefox.FirefoxProfile.layoutOnDisk(FirefoxProfile.java:482)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:76)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:80)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:77)
at com.screen.HTMLParseExample.main(HTMLParseExample.java:15)

Help me out Thanks in Advance.

Nitesh Soomani
  • 572
  • 5
  • 12
  • seems there is some problem, you're calling a non existing method, check this question http://stackoverflow.com/questions/22116299/solving-nosuchmethoderror-exception-thrown-using-reflection – Jordi Castilla Aug 24 '15 at 10:47

3 Answers3

2

Looks like you have incompatible versions of selemenium and com.google.guava. The method is existent and deprecated in version 15. but in version 19 it is not longer existent.

Jens
  • 67,715
  • 15
  • 98
  • 113
1

guava v 19 worked for me

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>

0

Change driver.close() to driver.quit() and whatever test cases you intend to implement in between the above two calls.

Misgevolution
  • 825
  • 10
  • 22