2
votes

Hi I am trying to Automate the input field for searching the equity on the website "https://www.nseindia.com/" using UFT. I am able to set value in the WebEdit field but I am not able to submit using UFT

Below is the descriptive code :

Set Obrowser = Browser("name:=NSE - National Stock Exchange of India Ltd\.")
Set oPage = Obrowser.Page("title:=NSE - National Stock Exchange of India Ltd\.")
oPage.WebList("html id:=QuoteSearch").Select "Equity"
oPage.WebEdit("name:=companyED","index:=0").Set "SBIN"
oPage.WebEdit("name:=companyED","index:=0").Submit
enter code here

Image of the field which is highlighted

Could you please help me in handling this type of input box which is shown in screenshot

1
Code looks like it should work. Suggest you try a click on the field first then use SendKeys to send SBIN{ENTER} to the field? - Dave

1 Answers

1
votes

I see that when you set a value in the search field we get a list of matching results. If you click on the appropriate result the search is performed. Instead of submit try the following:

oPage.WebElement("html id:=ajax_response").Link("text:=.*SBIN.*").Click

This assumes there is only one match (you can fine-tune it if there are more).

Explanation:

We first look for the list of results that fit the search term (this is in a SPAN with id=ajax_response). Then, under that, we look for the Link that we want to click on. In this case there's only one match so the description doesn't really matter.