Webdriver script failing are JMeter + JUnit Request

878 views
Skip to first unread message

Sanit Thale

unread,
Oct 8, 2014, 10:54:52 AM10/8/14
to jmeter-...@googlegroups.com
Hi ,

Our requirement is run Webdriver script for performance testing.
So we have done integration with Webdriver + JUnit Request and JMeter. 
Where we created Webdriver script with JUnit 4 and placed its jar and dependent jar in required folder.


But the problem we are facing is when we try to run the test cases with single or multiple instance, it fails with error for first instance 
Error -- firefoxLocal(org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase): INSTANCE 
and for remaining instances 
Error -- firefoxLocal(org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase): Could not initialize class org.apache.http.impl.conn.ManagedHttpClientConnectionFactory

Its not able create instance of Webdriver, RemoteWebDriver  when we tries to run from JMeter. 

Any Help is appreciated 

=========================================================================================
public class LoadTest {

@Before
public void setUp() {
System.out.println("========SETUP=========");
}

@After
public void tearDown() {
System.out.println("=======TEARDOWN=======");
}

@Test
public void remoteWedriverTest() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities = DesiredCapabilities.firefox();
capabilities.setJavascriptEnabled(true);
capabilities.setBrowserName("chrome");
capabilities.setPlatform(org.openqa.selenium.Platform.ANY);
System.out.println("Before Instance");
WebDriver driver = new RemoteWebDriver(new URL(
"http://localhost:4444/wd/hub"), capabilities);
driver.get("http://www.google.com");
driver.quit();
}
}

============================================================================================
JMeter Screenshot : 

Thanks 
Sanit Thale.
Message has been deleted

Sanit Thale

unread,
Oct 9, 2014, 5:32:43 AM10/9/14
to jmeter-...@googlegroups.com
Hi All,


Problem solved after adding jar which comes with webdriver samplers


superkings

unread,
Oct 10, 2014, 6:57:36 AM10/10/14
to jmeter-...@googlegroups.com
Hi Sanit,

Thanks in advance..

Sanit Thale

unread,
Oct 10, 2014, 7:11:06 AM10/10/14
to jmeter-...@googlegroups.com
Hi ,

Me too followed same steps , initially i got some problems like my methods were not available in jmeter and second selenium script was not started.
If you can provide more details like error or exception then we can solve your issue.

Thanks
Sanit

superkings

unread,
Oct 10, 2014, 7:19:44 AM10/10/14
to jmeter-...@googlegroups.com
Hi Sanit,
Thanks for quick reply
For me methods are available but after clicking on run i am not able to see any exception but in view result tree the request name is coming in orange colour. Please help me out.

Thanks in advance....

Sanit Thale

unread,
Oct 10, 2014, 7:26:38 AM10/10/14
to jmeter-...@googlegroups.com

U should check options append runtime exceptions in JUnit request. Then it will print error in result tree

superkings

unread,
Oct 10, 2014, 7:31:43 AM10/10/14
to jmeter-...@googlegroups.com
After checking also not able to see error message Sanit.

Sanit Thale

unread,
Oct 10, 2014, 7:48:46 AM10/10/14
to jmeter-...@googlegroups.com
Can u share u sample junit script or screenshot may be, figure out the problem.
We will not able solve it until we analyse the issue.

Thanks,
Sanit 

superkings

unread,
Oct 10, 2014, 7:56:42 AM10/10/14
to jmeter-...@googlegroups.com

Please find the attached code and screenshot Sanit.
Thanks a lot for your quick responses :)
TestClass.txt
Message has been deleted

Sanit Thale

unread,
Oct 10, 2014, 8:22:09 AM10/10/14
to jmeter-...@googlegroups.com
Hi,

I was able to run your script just set binary path for Firefox. Seems to be nothing wrong with script, please check all the supporting selenium jars are jmeter/lib

If still does not work then there may be any proxy issue or issue that im not aware of.


public class TestClass {

private WebDriver driver;
public String searchQuery = "find a dealer";

By searchBox = By.id("gbqfqw");
By submitSearch = By.id("gbqfba");

@Before
public void setUp() {
File pathToBinary = new File(
"C:\\Local\\Mozilla Firefox\\firefox.exe");
FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
FirefoxProfile firefoxProfile = new FirefoxProfile();
driver = new FirefoxDriver(ffBinary, firefoxProfile);
driver.get("http://www.google.com");
}

@After
public void tearDown() {
driver.quit();
}

@Test
public void checkTitle() {
Assert.assertEquals("Google", driver.getTitle());
}

@Test
public void checkSearchBoxExists() {
boolean searchBoxes = driver.findElement(searchBox).isDisplayed();
Assert.assertTrue(searchBoxes);
}

}


Thanks,
Sanit Thale.

superkings

unread,
Oct 10, 2014, 8:38:07 AM10/10/14
to jmeter-...@googlegroups.com
Thank you for your good support Sanit.
After changing the code also still not working in my machine.

superkings

unread,
Oct 10, 2014, 10:16:57 AM10/10/14
to jmeter-...@googlegroups.com
Hi Sanit,

After adding this plugin  JMeterPlugins-WebDriver-1.1.1
Now able to invoke browser through Jmeter using selenium webdriver-junit.

Thank you very much for your quick replies:)

Sanit Thale

unread,
Oct 14, 2014, 1:21:16 AM10/14/14
to jmeter-...@googlegroups.com

U welcome

--
You received this message because you are subscribed to a topic in the Google Groups "jmeter-plugins" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jmeter-plugins/u9PwMLeNAkE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jmeter-plugin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages