failure to close UI debuggers in Chrome - java

We are using testng with selenium. We can use IE, Firefox or Chrome but almost always use Chrome. At the beginning of each test, a driver instance is obtained (as shown below) depending on the browser. This has been working fine but lately, and then just once, one test failed with the error message "org.openqa.selenium.SessionNotCreatedException: session not created exception
from unknown error: failed to close UI debuggers" I did some searches in Google and other people had similar problems but I did not see a lot of resolution. My guess is that it was some temporary technical glitch or network problem. But I am curious whether anyone has gotten this error, and moreover what it might mean? Not sure whether it helps, but it was developed on Eclipse, and a jar created (with a bat file to execute the tests). The tests were being run from this jar file and only one failed, and only once.
// capabilities for different browsers.
extraCapabilities.setCapability(CapabilityType.PROXY, seleniumProxyObject);
extraCapabilities.setCapability("ie.setProxyByServer", true);
extraCapabilities.setCapability("ie.usePerProcessProxy", true);
extraCapabilities.setCapability("download.default_directory", System.getProperty("java.io.tmpdir"));
// create driver with additional capabilities
webDriver = DriverFactory.getDriverInstance(driver, browser, extraCapabilities);

Related

IOSDriver() is not working. Instead it is opening remote session, when I using RemoteWebDriver() that time my test cases are passing

Hi can anyone help me why this is happening i have no idea, for my appium mobile test scripts for MAC iPad app, when I i use IOSDriver() it is not working giving me multiple errors such as randomly, sometimes session cannot b created, or no element found, etc., and the same code when I run with RemoteWebDriver() it is working fine and executing all my test cases.

Appium/TestNG script on AWS device farm - could not find element

I am setting up my Appium/TestNG script in java on AWS Device Farm, using the tutorial: http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-android-appium-java-testng.html
After I compile and upload the 'zip-with-dependencies.zip' to AWS Device Farm and run the tests on a device, I get an error, that the first clickable element in the script could not be found.
So the Setup and Teardown suite are passing in the run, but the actual test fails every time:
Failure Description on AWS Device Farm
My question is am I missing something from the configuration or is the script in need of any extra desired capabilities in order to actually execute the test on AWS Device Farm?
I changed the version of the tested app with another one, seems like the previous one, where the element could not be found was popping out an android system message, which could not be clicked with the provided code, hence the searched element could not be found.
Another thing that device farm is not so good at - providing real time observations on the running tests, which could save a lot of time in this situations.
Answering this for people who are still facing this issue.
You have to set up the automationName desired capability to the automation mechanism that you are using to automate the tests.
For me setting it up to uiautomator2 works.
capabilities.setCapability("automationName", "uiautomator2");
Two suggestions:
1. Set element waiting time to be less than 60 seconds, because default Appium session will timeout after that.
2. Create a screenshot for the failure, check whether the element was loaded correctly.
Hope this would help:)
Thanks,
Hongda

Error: When i minimize Internet Explorer which is running the automated WebDriver Code

I have written the Selenium webdriver java code to automate the test and its working fine. But I have lot of data input to test my web and it takes time. So when i minimize the IE to do some other task while it is running the automation, it is throwing error:
org.openqa.selenium.ElementNotVisibleException: Element is not displayed
Selenium WebDriver is trying to simulate "real" users interaction with the webpage. If a person can't click on a button not currently displayed, neither can Selenium.
ElementNotVisibleException occurs when the element you want to interact with is not displayed. When you minimize the browser some of the elements are no longer visible, even though they where in maximized window.
You can add scroll using moveToElement() from Actions class every time you want to perform any action (I don't recommend it, you increase significantly the chance for errors), or find another hardware solution, like plugging in another screen, run the test on another computer etc.
According to my experience, the Internet Explorer WebDriver is very oversensitive when it comes to disturbances from a real user while running test cases. It's better to not touch anything at all. ;-)
Try Chrome! This is much more robust and also faster.
Selenium script runs as a simulator. You cannot do another work when script is running. Chrome is fast but while running script in chrome you can not do other task like any other browser. If you minimize window, you will get exception "ElementNotVisible".

Configuration of selenium webdriver with xorg-x11-server-Xvfb

We have developed selenium webdriver script with junit+java using eclipse on window 7. All the scripts are working as expected now we are using this script for load testing using Jmeter. However, while running script system open multiple browser (200) based on user thread and it create system to hang, is there any way to handle this or we can run script without opening browser. I have come across xvfb tool, but not able to get java api for this tool to plugin in eclipse.
We have also tried using HtmlUnitDriver but as it does not support javascript hence the test is getting failed, also we tried HtmlUnit and found same thing.
Note: that we have writen webdriver script to maintain display item of element (autocomplete, image) on screen.
It would be great if anyone can help or provide more inputs on this...
Firstly, do not integrate selenium scripts with JMeter for load testing! It's not a good approach to follow due to the obvious consequences that you have mentioned in your post. I followed a similar apporach in the beginning when I was new to JMeter and selenium but suffered a great deal when it came to running load tests that spawned too many browser instances which killed the OS.
You can go for HtmlUnitDriver or any headless browser testing tools out there with JMeter, but still, they will be running the browser internally in the memory. Moreover if your application is heavily using Javascript, it won't help.
So I would suggest that you record a browsing session with JMeter Proxy and modify the script (set of requests) according to your needs and play those requests alone, with number of threads.
From a higher level, you should be doing this:
Add a JMeter test plan, listeners, thread group and setup JMeter proxy and record a browsing session where you enter something into the autocomplete textbox and you get certain results.
Stop your proxy and take a look at all the requests that come under your thread group.
As far as I know, when it comes to autocomplete plugins, multiple
requests are sent everytime you enter a letter into the textbox. For
example, for the word 'stackoverflow':
Request1: q=s Request2: q=st Request3: q=sta and so on
Here you can simulate this effect by including words such that all
words have the same length which in turn will let you have same
number of requests to be sent to the server.
So in your test plan, you will pass one word per Jmeter thread. You
can pass the words to a request, from a csv file by using jmeter
parametrization.
This will be a much memory efficient way of load testing instead of using selenium with JMeter. I had asked a similar question. You can check out the responses.

Execute Selenium Commands on a Browser that is already open

I am looking for an example code that will allow me to run Selenium commands against a browser that is already open.
Typically when you start testing with Selenium it opens a new instance of the browser. But I am looking
for a solution where you would run the script and it will just start executing its codes on whatever browser and tab is currently visible.
Is that possible?
As per my knowledge this is not possible with selenium.
You have to open browser during the test script only otherwise it won't be able to identify or capture already opened browser's object.
No its not. There is an old issue still open since 2009.

Categories

Resources