We're using a 3rd party provider to run some our Selenium tests against browsers and devices we don't have here. One of these is an iPad.
Currently we open/instantiate the webdriver with this code in Ruby:
driver = Selenium::WebDriver.for(:remote, :url => url, :desired_capabilities => capabilities)
that works great when running against this 3rd party service if we're firing up instances of Chrome or FireFox. For iOS however they spin up a virtual machine with an iOS simulator, and very often the call above will timeout before the sim's browser is ready. They have acknowledged their VM startup times could be better.
But it is what it is. As far as practical next steps are concerned is there a way I can customize the timeout value when creating the remote webdriver?
What is the third party you are using? Is it by chance SauceLabs?
I'm not sure if this will work universally but you should be able to set timeout configurations on the desired capability object. Here's some sample code from my test project in java:
/**
* Sets the default capabilities for the RemoteWebDriver we use for SauceLabs
*
* #param capabilities the capabilities to set defaults to
* #return the DesiredCapabilities object after setting the default values
*/
private static DesiredCapabilities setDefaultCapabilities(DesiredCapabilities capabilities)
{
// Set job some defaults
capabilities.setCapability("max-duration", DEFAULT_TEST_TIMEOUT);
capabilities.setCapability("command-timeout", DEFAULT_COMMAND_TIMEOUT);
capabilities.setCapability("idle-timeout", DEFAULT_IDLE_TIMEOUT);
capabilities.setCapability("selenium-version", DEFAULT_SELENIUM_VERSION);
// Additional settings to help debugging and improve job perf
capabilities.setCapability("public", "share");
capabilities.setCapability("webdriver.remote.quietExceptions", false);
capabilities.setCapability("capture-html", true);
capabilities.setCapability("video-upload-on-pass", false);
return capabilities;
}
Here's the SauceLabs documentation for the capabilities: https://docs.saucelabs.com/reference/test-configuration/
Related
I am currently in the process, with a Jmeter script, of opening firefox browsers which are functional. However, I have a small problem which is to let the browsers turn on even after the script is finished.
Currently my browsers turn off once the script is finished.
Here is my code :
WDS.sampleResult.sampleStart()
def display = WDS.vars.get("DISPLAY");
WDS.browser.get('url'+ display +'set')
WDS.sampleResult.sampleEnd()
Is there a possibility to do it?
Are there additional parameters to set in the webdriver sampler, because I don't have an HTTP Sampler or even HTTP cookies.
Thank you for your time
I think if you tick Development Mode box the browser will remain open:
If it doesn't fit your needs, i.e. you're using headless or Remote WebDriver, looking in the source code
#Override
public void threadFinished() {
if (!isDevMode()) {
final T browser = removeThreadBrowser();
quitBrowser(browser);
}
}
so just comment out/remove this quitBrowser function, recompile the plugin and replace the version in the "lib/ext" folder with your own one.
and last but not the least the browser is being shut down when your test ends, if you want to keep the browser open it's sufficient to configure your test so it would never end by adding i.e. Flow Control Action sampler configured to sleep the required amount of time or just adding the next line as the last one in your WebDriver Sampler code:
Thread.sleep(3600000)
the line will pause the execution for 1 hour, hopefully this time will be sufficient for troubleshooting.
More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?
I am trying to run Jmeter Webdriver script in Blazemeter. The browser is getting launched but subsequent requests are failing. Further investigation it was identified that the chrome driver is not able to launch the expected URL due to proxy requirements.
I tried to use proxy settings in Jmeter Set Up Thread Group using JSR223 sampler.
Below is the code for the same.
With this I am getting "The driver is not executable error" in Blazemeter.
Proxy proxy = new Proxy();
proxy.setHTTPProxy("xyz.net:1234");
proxy.SslProxy("xyz.net:1234");
ChromeOptions options = new ChromeOptions();
options.setCapability ("proxy", proxy);
System.setProperty("webdriver.chromedriver", "chromedriver");
driver = new ChromeDriver(options);
I believe it's better to address this form of questions to BlazeMeter Support
The driver is not executable error doesn't have anything in common with proxies, you need to amend your chromedriver permissions to allow its execution)
Take the following steps:
Add setUp Thread Group to your test plan
Add OS Process Sampler to your Thread Group
Configure it as follows:
That's it, you should be able to launch the browser now
I want to run my test in parallel on Selenium Grid on IE browser 11.
I have one Hub machine(VDI machine) on which i have one node as well.
Machine 1 , Hub1 and Node1
For the second Node i have another VDI machine.
Machine 2 and Node2.
4.When i use Machine 1 , Hub1 and Node 1.
I can initiate IE browsers.
5.How ever when i use :-
Machine 1 , Hub1 and Node1
and
Machine 2 and Node2.
6.I can not initiate IE browser on both machines.
I get the Selenium webdriver error:-
"Protected mode must be set to the same value(enabled or disabled) for all zones."
How should i resolve this. I donot have the rights to change the security of the VDI machines.
"Protected mode must be set to the same value(enabled or disabled) for all zones."
You could follow the steps to make it work.
In IE, find Internet options and open it.
Go to the Security tab.
Set the value of the check box "Enable Protected Mode" to the same value, either checked or unchecked, for each zone.
I've checked this on my VM, it is possible to set the security of IE options.
Using selenium 4.1.1
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.ignoreZoomSettings();
ieOptions.introduceFlakinessByIgnoringSecurityDomains();
ieOptions.setCapability("ignoreProtectedModeSettings", true);
ieOptions.setCapability("requireWindowFocus", true);
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444"), ieOptions);
setCapability("ignoreProtectedModeSettings", true); // Use this Capability to ignore protected mode settings
I am using Selenium 2.32, IEDriverServer 2.32, Eclipse, Java JDK 1.6.0_43 with Windows 7 and IE9. The code that i use to launch the driver is
File file = new File("IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
WebDriver driver = new InternetExplorerDriver(ieCapabilities);
In IE9, When i click on a link which opens a new browser, the driver.getWindowHandles() returns only one browser (Parent browser) and the new browser is never identified. When i use the same code with IE 8, it works and it identifies the new browser.
Due to company policy, the 'Security' settings are different for different zones in IE9. For two zones, the 'Enable Protected Mode' is enabled and while in other zones, the mode is not enabled. Is this the reason for the issue?. Please suggest.
Steps are as below:
'Enable Protected Mode' should be checked for all the zones and
security level should be set to "Medium".
Give some time to load the page using Thread.sleep(). Now you will
get correct value for getWindowHandles() method.
I'm using Selenium 2 (in IE only) and I need to capture all page resources (js, css, images files etc.) and their HTTP status.
I tried to use HTTP analyzer for this but this tool is very unstable and crashes all the time.
Could you please advise how I can resolve my problem?
You will need to use a proxy to do something like this. Selenium does not intercept HTTP traffic so cannot do this itself (There is an old capturenetworktraffic implementation in Selenium 1 but that was using some FireFox specific code and did not work for any other browsers).
To configure it:
Proxy proxy = new Proxy();
proxy.setHttpProxy(<proxyAddress>);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);
This should enable you to capture network traffic and as a result capture http status codes of various page resources.