Showing posts with label Problems you faced in selenium automation. Show all posts
Showing posts with label Problems you faced in selenium automation. Show all posts

Wednesday, January 3, 2018

Challenges we faced in Selenium Automation Testing

I work on Selenium Automation Testing and one of the major challenging tasks which I faced was, After invoking the application URL on any browser, it was required to authenticate the window based pop-up as below. The first challenge was selenium doesn't handle windows based pop-ups.

The solution is AutoIt tool (Click here!)
I wrote code using AutoIt which can easily handle the window based pop-up to enter credentials.
About AutoIt tool:
AutoIt is a tool where we can capture window based objects and write a simple AutoIt script. Once we compile & Run the AutoIt script file, It will generate the .exe file and which can be invoked within our selenium automation scripts.
Now, all we need to do is call the .exe soon after invoking the application URL. Please refer the sample code below
driver.get("application URL");
Runtime.getRuntime().exec("path where the .exe file exists");
Now the actual problem was AutoIt code was not getting triggered after invoking the application URL - driver.get("application URL").
Please find the solution to the above problem:
Subsequent lines of code will not execute unless execution of driver.get("application URL") method is complete. We found out that driver.get("application URL") was not getting completed unless we complete the window based pop-up operation.
The only solution is to run both driver.get("application URL") method and AutoIT code in parallel. This can be achieved with help of Java multi-threading.
After invoking the application URL, We will be giving control to window based pop-up and due to parallel execution, AutoIt.exe code will trigger and enter the credentials in a window based pop-up and completes the operation. Due to this, driver.get("application URL") method will also gets completed.
Code:
driver.get("application URL");
AUTOIT startExe=new AUTOIT ();
Thread t1 =new Thread(startExe);
t1.start();
Finally, I solved the issue.
Feel free to share your valuable feedback.Thanks.