selenium script in jmeter - selenium

I had write a script using selenium in Jmeter. Imported all the packages.
var pkg=JavaImporter(org.openqa.selenium) //import java selenium package
var support_ui=JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)
var ui=JavaImporter(org.openqa.selenium.support.ui)
var wait=new support_ui.WebDriverWait(WDS.browser,5000)
WDS.sampleResult.sampleStart()
WDS.browser.get('https://www.google.com')
WDS.sampleResult.sampleEnd()
to simply open the page.
it doesn't show any results in Listener.

Have you added the relevant Config element, like:
Firefox Driver Config
Chrome Driver Config
Phantom JS Driver Config
or whatever browser you're trying to use?
If yes and you still experience problems - check jmeter.log file - it usually contains enough troubleshooting information. The most common errors are:
libraries conflict. Selenium requires newer HTTP libraries version than JMeter so:
open /lib folder of your JMeter installation
locate .jar files which names start with http
delete duplicate .jar files with lesser version
unsupported browser (mostly affects Firefox). If you're trying to run Selenium test on Firefox - make sure you use one of the supported versions. Latest JMeter Plugins WebDriver Set 1.3.1 comes with Selenium 2.47.0 and according to the changelog it should be:
Supports native events for Firefox version 31 (immediately previous ESR).
Native event support has been discontinued for versions of Firefox later
than 33. Synthetic events tested on Firefox versions 31 (immediately
previous ESR), 38 (immediately previous release and current ESR), and 39
(current release).
For extra information and tips on using WebDriver Sampler in JMeter check out The WebDriver Sampler: Your Top 10 Questions Answered guide

Related

Where can we find the Selenium version compatible versions of GeckoDriver

Earlier I used this method to add gecko driver:
System.setProperty("webdriver.gecko.driver", "/home/boo/Desktop/java/geckodriver-v0.20.1-linux64/geckodriver");
but the new update (https://selenium.dev/)
https://selenium.org/ --> https://selenium.dev/
Now it redirects so I have no idea how can I download , when I download it saves as .nupke I download from here
selenium.webdriver.geckodriver.0.26.0.nupkg
How can I use this .nupkg?
And there is other 4 method available
package-manager
dotnet-cli
package-reference
paket-cli
I'm using Java Maven for automation in those 4. Which one I have to choose and how can i setup?
PS: earlier I downloaded zip file and extracted and used it
Selenium and GeckoDriver are seperately maintained and published. You can download the required version of GeckoDriver from Releases - mozilla/geckodriver page.

When replacing selenium jars with latest version under JMeter lib folder 'ConversionException' is thrown

I am working with JMeter and Selenium. Installed the plugins manager and via that, installed web-driver sampler. When I look into lib folder, I found the selenium jars version are 2.52.0 which is much older. I can able to work with that without any issues. But the real problem is:
Using Maven, I updated all the selenium jars to 3.9.1 version and its dependant jars like guava, gson, commons, etc.
Now, when I open the jmx files with WebDriver sampler and driver configs, I receive below error.
Using maven, I mean, I downloaded all the jars from maven repo manually and pasted into JMeter lib folder.
Please help me to work with latest Selenium drivers in JMeter.
You won't be able to use WebDriver Sampler plugin with Selenium 3.9.1 as it explicitly relies on SessionNotFoundException class which has been removed in the latest Selenium libraries.
So the options are in:
Use WebDriver Sampler with browser version(s) supported by Selenium 2.52.0
Reach out to WebDriver Sampler plugin developers and/or maintainers at jmeter-plugins forum to check whether it is planned to update Selenium libraries and if yes - when. You can also update WebDriver Sampler source code by yourself and send pull request to the plugin maintainer.
Switch to JSR223 Sampler and Groovy language instead. Apart from being able to use latest libraries you will have full control of the WebDriver instance using DesiredCapabilities at full instead of limited subset exposed via *Driver Config elements.

Use most recent browser version with JMeter Selenium Webdriver

Im trying to use JMeter with the Selenium WebDriver plugin to do some testing. I know that it requires Firefox v. 26, however I find this to be pretty useless given that testing on anything besides the most recent browser version is pointless, as that is what users will be using.
Using the current WebDriver plugin with Firefox v 50 results in the 'browser.get()' not working. Is there a way to get the plugin to work with Firefox 50?
The latest Selenium/WebDriver Support plugin available via JMeter Plugins manager as of now is version 1.4.0. It comes with selenium-firefox-driver-2.52.0
It means any browser supported by Selenium 2.52.0 will be supported
Looking into Selenium Changelog Selenium 2.52.0 supports Firefox 45 which is an ESR release according to Mozilla FAQ:
I don't know where did you get the information regarding Firefox 26, I would recommend upgrading to Firefox 45 which should be supported till June 2017 and hopefully JMeter Plugins maintainers will upgrade Selenium libraries to version 3 by that time.
In general WebDriver will be always behind the browsers development so you will have to live with the supported versions.
References:
JMeter Plugins Forum
The WebDriver Sampler: Your Top 10 Questions Answered

Not able to run webdriver scripts from jmeter

I am trying to execute webdriver script from jmeter.
I have installed webdriver plugin.
Created firefox config element and web driver sampler.
Added script under webdriver sampler -
WDS.sampleResult.sampleStart()
WDS.browser.get('http://google.com')
WDS.sampleResult.sampleEnd()
But while executing, browser is not opening.
I'm pretty much sure that you have Firefox version which is not supported by underlying Selenium libraries.
WebDriver Sampler plugin 1.2.1 supports Firefox 33
WebDriver Sampler plugin 1.2.0 supports Firefox 26
If you need the latest Firefox for any other reason you can have Firefox 26 or 33 installed somewhere else. Just add the following line to system.properties file (lives under /bin folder of your JMeter installation)
webdriver.firefox.bin=/path/to/your/firefox/directory
See The WebDriver Sampler: Your Top 10 Questions Answered guide for more WebDriver sampler tips and tricks.
Jmeter only supports some of the versions of Firefox to run Jmeter-webdriver script. Use firefox 45.0 it will work like pro.
The Installation of firefox should be in the default directory, do not custome the path of Firefox 45.0.

re-development of Chrome webdriver

I hear that webdriver for Chrome is being re-developed as part of the Chromium project (since the original Chrome webdriver of the selenium project is unusable). Does anyone know if development is complete? If so, where can I find the jars? Has it been pushed to maven central yet?
The new Chrome driver has been checked into the Chromium project tree, and the binaries made available on the Selenium project site. The individual language bindings for the Chrome driver will still be included in the Selenium downloads. Information about what is required to run the new Chrome driver can be found in the project wiki. Note that Chrome 12.0.712.0 or higher is required to work with the new Chrome driver.
The .jars, as of this writing, are not available yet in any Maven repository. You can expect that to change when the next public release of the compiled sources is available. In the interim, you can build from the latest sources yourself.