UFT-TestNG Framework communication
WebDriver to operate on an already opened browser

UFT-TestNG Framework communication

I would like to share a very simple workaround devised for a requirement where UFT framework requires to communicate to TestNG framework and both Framework needed to run on same time. As an example, UFT runs on VB app and TestNG on Web browsers on same machine or different machines.

Please feel fee to post your feedback and comments for any other similar solution for this requirement.

Requirement:

My requirement was on UFT while executing VB application, it generated browser applications. I needed TestNG to pick browser opened by UFT and do certain navigation as per TestNG script flow. As Selenium WebDriver cannot interact with an already opened browser by non-WebDriver process or there is no direct method to achieve this, this workaround is developed and this idea helped me to run UFT on VB applications and TestNG on Browser application same time on same machine. I could easily expand this framework to run multiple nodes with the help of Selenium Grid which helps browser execution on different nodes while UFT executes on VB application on hub machine.

Solution:

The following steps were designed to communicate UFT Framework to TestNG

  1. UFT while running its framework, writes the URL details into a text file named “UFT.txt” – refer below code.

Code Line 18 below will have your URL generated by UFT and will store that URL in TEXT file

2. Then UFT will communicate to Selenium via windows batch file “ABC.bat”

3. Below batch file will trigger and start the Selenium TestNG framework (below batch file contents will trigger TestNG script initiation)

4. Refer TestNG “BeforeTest” annotation section, where additional piece of code added to capture the URL from UFT.txt file and provide that URL to driver as per code below (Selenium – Eclipse editor snapshot below) .

Refer Line 36 thru 61

5. Selenium TestNG will take care remaining process of browser actions based on how you code the remaining flow with browser.




要查看或添加评论,请登录

Sharath Chandran的更多文章

社区洞察

其他会员也浏览了