Highlighted
Super Contributor.
Super Contributor.
933 views

UFT WebElement selection example not working

Jump to solution

Given a WebElement in my OR that is used as a drop-down menu, I have the line:
Browser("B").Page("P").WebElement("DropDownMenu").Click

Running the Action (script) will have the web browser click and the menu appears.

Browser("B").Page("P").WebElement("DropDownMenu").Object.innertext = "choice"
(where choice is the menu item I want clicked) is what I want

It doesn't work!
Does anyone know how to get the WebElement to work as a drop-down menu in script?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Honored Contributor.
Honored Contributor.

Re: UFT WebElement selection example not working

Jump to solution

From what I understand, you have a drop down menu, which is recognized as a webelement. You are able to click on it, but not able to select from the drop down options... 

In such case, you have to first click on the drop down, to make the options visible, then each option could by itself be another webelement, which can be selected using DP.... 

Browser("B").Page("P").WebElement("DropDownMenu").Click

Browser("B").Page("P").WebElement("outertext:=choice").click  ... you can use any other property that helps identify the option webelment.

If my assumption is wrong, please attach a screen shot.. so that we can understand the requirement.

GoScriptLESS, Create Tests in seconds using UFT. View Demo at scriptlessautomation.com

View solution in original post

4 Replies
Highlighted
Honored Contributor.
Honored Contributor.

Re: UFT WebElement selection example not working

Jump to solution

From what I understand, you have a drop down menu, which is recognized as a webelement. You are able to click on it, but not able to select from the drop down options... 

In such case, you have to first click on the drop down, to make the options visible, then each option could by itself be another webelement, which can be selected using DP.... 

Browser("B").Page("P").WebElement("DropDownMenu").Click

Browser("B").Page("P").WebElement("outertext:=choice").click  ... you can use any other property that helps identify the option webelment.

If my assumption is wrong, please attach a screen shot.. so that we can understand the requirement.

GoScriptLESS, Create Tests in seconds using UFT. View Demo at scriptlessautomation.com

View solution in original post

Highlighted
Knowledge Partner
Knowledge Partner

Re: UFT WebElement selection example not working

Jump to solution

I've also see this where the contents of a drop down were links.

Mark Smith.

Highlighted
Super Contributor.
Super Contributor.

Re: UFT WebElement selection example not working

Jump to solution

GoScriptless1,
I'll try it.

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: UFT WebElement selection example not working

Jump to solution

GoScriptless!

I applied your fix:

Browser("B").Page("P").WebElement("DropDownMenu").Click

Browser("B").Page("P").WebElement("outertext:=choice").click 

and it worked!
Thanks tonzoes!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.