Saturday, January 2, 2021

HackerRank 2D Array - DS

 

Thursday, December 10, 2020

Debug your WebDriver script easily by connecting to existing Chrome Browser


Step1:

Open Chrome browser using --remote-debugging-port

Step2:
Ensure you have correct chromedriver.exe downloaded which matches with your chrome browser version.

Step3:
Connect to this browser by writing a separate code for debug to handle browser

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("debuggerAddress","localhost:1234");

ChromeDriver driver = new ChromeDriver(chromeOptions);
..... 
......

Notes: You can set your application from where you want to test , and start from respective step.

In this example used port 1234 , you are free to use any available port in your system.


Wednesday, November 25, 2020

 

Highlight Element and Disable Highlight using JSExecutor

((JavascriptExecutor) driver).executeScript("arguments[0].setAttribute('style', arguments[1]);", element,"color: yellow; border: 5px solid red;");

((JavascriptExecutor) driver).executeScript("arguments[0].setAttribute('style', arguments[1]);", element,"");

 

QTP Jenkins Execution Issues & Solutions



Ensure that the respective machine have been installed with QTP license, without this we can't run tests.

Resolution 1:
Login to the execution system and try to launch QTP manually. This step helps to find out any issues with license.

Resolution 2: Check the service Uft4Winrt is available, if not restart the system.
Select Uft4Winrt service , go to properties , click 'Log On'
Select 'Local System account' radio button and Select 'Allow service to interact with desktop' checkbox.

Resolution 3: Check the below DCom Config settings.
From start command: type dcomcnfg to open the Component Services
Go to Component Services -> Computers->My Computer->DCOM Config->
Configure properties of each application entries listed below. Double click each one check the details under Tabs ‘Security’ and ‘Identity’.

List of Applications Names:

HP Unified Functional Testing
HP.QTP.Automation.Agent.AOMObjects.AutomationUpdateRunOptionsObject
QtpExtensionInterface
QuickTest Professional Automation
UFTRemoteAgent

In Identity tab > Ensure 'Interactive user' radiobutton is selected.
In Security tab > Access Permissions > Select 'Customize' radiobutton and Edit Button
Select Permissions to "Self' Ensure to select  'Allow' for both Local and Remote Access. 

Resolution 4: With above if issue is not resolved continue with below steps
UFT tried to launch with 32-bit , so need to update settings.

Use the command to open the DCOM
Go to CMD prompt and type the command: C:\WINDOWS\SysWOW64>mmc comexp.msc /32
DCOM window:
Console Root > Component Services > Computers >My Computer >DCOM Config >
Repeat Resolution3.

Resolution 5: There might be issue with Microsoft Excel too
Run->dcomcnfg->Go to Component Services -> Computers->My Computer->DCOM Config->Microsoft Excel Application->Right click->Identity Tab-> Select ‘The interactive user’-> OK.

Repeat the above if issue persist with C:\WINDOWS\SysWOW64>mmc comexp.msc /32

Resolution 6: Jenkins job might failed due to msxml3.dll 
Register using below steps
1.regsvr32 msxml3.dll hit enter
2. Should get the successful registration
3. Restart the system

Monday, September 4, 2017

Do we need to use Protractor ?

Protractor is an end-to-end test framework for Angular and AngularJS applications.  And allows us to test application from the user's perspective.

Basically Protractor is wrapper over selenium WebDriver. (So you are inheriting all existing issues which are in open from WebDriver). 

One of the benefit of using protractor is that there is no need to add waits for synchronization as it is done automatically by Protractor.

If you are already using your established framework with explicit , fluent and other wait mechanisms you should be able to write the tests as the same how you have done for Non Angular applications. 

I hope it might be little easy to maintain and write tests for Angular using your frameworks as you are already expertise and familiar with your coding style, locator mechanism , tool set and issues. 

And  I don't see a reason 

  1. To completely change the way you are presently doing  (unless you have done some POC to see the difference with new tools).
  2. Spending time to learn,understand new set of tools.  (eg: Protractor,Mocha, Chai ,Jasmine,Reports etc.) 


And finally its all depended on your POC and comparisons with your existing tools/framework Pros and Cons.

Tuesday, March 4, 2014

Mouse Action using JS

Mouse Over and MouseOut

JavascriptExecutor executor = (JavascriptExecutor)DriverFactory.getDriver();
        executor.executeScript("if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseover', true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmouseover');}", element);
                         executor.executeScript("if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseout', true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmouseout');}", element);

Mouse Click

 JavascriptExecutor executor = (JavascriptExecutor)DriverFactory.getDriver();
                executor.executeScript("if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mousedown', true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmousedown');}", element);
                executor.executeScript("if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseup', true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmouseup');}", element);
        }