Only Chrome Browser working while others Browser not worrking | Selenium Forum
C
Cheong Kah Seng Posted on 09/11/2020

Following is the error code when running Mozilla, and IE

[RemoteTestNG] detected TestNG version 7.0.0
FAILED: testB
java.lang.NoSuchMethodError: 'void com.google.common.io.Closeables.closeQuietly(java.io.Closeable)'
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:115)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:79)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:67)
at org.openqa.selenium.firefox.FirefoxDriver.getProfile(FirefoxDriver.java:203)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:179)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:142)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:84)
at com.qtpselenium.core.ddf.base.BaseTest.openBrowser(BaseTest.java:16)
at com.qtpselenium.core.ddf.testcases.DummyTestB.testB(DummyTestB.java:12)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:770)
at org.testng.TestRunner.run(TestRunner.java:591)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355)
at org.testng.SuiteRunner.run(SuiteRunner.java:304)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1102)
at org.testng.TestNG.runSuites(TestNG.java:1032)
at org.testng.TestNG.run(TestNG.java:1000)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)


===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================

IE: 

[RemoteTestNG] detected TestNG version 7.0.0
FAILED: testB
java.lang.NoSuchMethodError: 'void com.google.common.io.Closeables.closeQuietly(java.io.Closeable)'
at org.openqa.selenium.io.FileHandler.copyResource(FileHandler.java:69)
at org.openqa.selenium.ie.InternetExplorerDriverServer.initializeLib(InternetExplorerDriverServer.java:84)
at org.openqa.selenium.ie.InternetExplorerDriverServer.<clinit>(InternetExplorerDriverServer.java:38)
at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:82)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:48)
at com.qtpselenium.core.ddf.base.BaseTest.openBrowser(BaseTest.java:24)
at com.qtpselenium.core.ddf.testcases.DummyTestB.testB(DummyTestB.java:12)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:770)
at org.testng.TestRunner.run(TestRunner.java:591)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355)
at org.testng.SuiteRunner.run(SuiteRunner.java:304)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1102)
at org.testng.TestNG.runSuites(TestNG.java:1032)
at org.testng.TestNG.run(TestNG.java:1000)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)


===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================

BaseTest.java: 

package com.qtpselenium.core.ddf.base;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class BaseTest {
//want to make some reusable function in basetest class
public WebDriver driver;


public void openBrowser(String bType) {
if(bType.equals("Mozilla")) {
System.setProperty("webdriver.gecko.driver", "C:\\webdrivers\\geckodriver.exe");
driver = new FirefoxDriver();
}
else if(bType.equals("Chrome")) {
System.setProperty("webdriver.chrome.driver", "C:\\webdrivers\\chromedriver.exe");
driver = new ChromeDriver();
}
else if(bType.equals("IE")) {
System.setProperty("webdriver.ie.driver", "C:\\webdrivers\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
}
}

public void navigate() {

}

public void click() {

}

public void type() {

}

/********************Validations************************/
public boolean verifyTitle() {
return false;
}

public boolean isElementPresent() {
return false;
}

public boolean verifyText() {
return false;
}

/********************Reporting**************************/
public void reportPass(String msg) {

}

public void reportFail(String msg) {

}

public void takeScreenshot() {

}
}


A
Ashish Replied on 10/11/2020

java.lang.NoSuchMethodError: 'void com.google.common.io.Closeables.closeQuietly(java.io.Closeable)'

com.google - there is some jar file which is certainly missing here. How did you add jars


Related Posts