I want to open a URL in the Chrome browser, but in mobile mode during my load test in JMeter. I am using Selenium scripts. Below is my Selenium script
var pkg = JavaImporter(org.openqa.selenium,org.openqa.selenium.support.ui) // Import Java Selenium packages
var Thr = JavaImporter(java.lang.Thread) // Import Thread sleep packages
var wait = new pkg.WebDriverWait(WDS.browser,30) // Import WebDriverWait Package
WDS.sampleResult.sampleStart()
WDS.browser.get('https://xyz=${__urlencode(${token})}');
WDS.sampleResult.sampleEnd()
Below is the Java class I have created in BeanShell
Preprocessor in Jmeter
to use Chromeoptions to open Chrome in mobile mode, but I don't know how I can call it in webdriver
above and I am doing it correctly or not:
public class page {
public static void main (String args[]) {
String device = "Samsung Galaxy S4";
//options.ChromeOptions options = new ChromeOptions();
ChromeOptions options = new ChromeOptions();
options.EnableMobileEmulation(device);
IWebDriver driver = new ChromeDriver(options);
}
}