Find method operation in web page
- 8 years ago
As shankar_r pointed out above, your code is incorrect. You have
p.Click()
This is incorrect. "p" represents the parent form that contains the button. So, calling "Click" against P will click on the form, not on the button. Your last lines of code need to look something like this:
var PropNames = new Array("ObjectType","idStr"); var PropValues = new Array("SubmitButton","ctl00_ContentMainHolder_btnAcceptPrivacyPolicy"); var myButton = p.Find(PropNames,PropValues,100); myButton.Click();
Specifically, note what I have highlighted in bold... THAT's what needs to change. Until you make that change, this won't work.
- 8 years ago
Manojrsr wrote:
Thank you very much,
Now I can able to click "Button"
As mentioned in before post, i have declared to click founded object as
var submit= p.Find(PropNames,PropValues,100);
after that i can't able to get any predefined method like Exists or Click.
Eg:
Submit.
You will not get those methods at that point because, as you're editing the code, the code editor doesn't know what is going to be returned in the "Find" object... "Submit" is an undefined/empty variable as you're editing so there won't be any predefined methods available off it.
This is one advantage of using NameMapping over find methodology in that, with NameMapping, you can have TestComplete store some of the basic CodeCompletion information for mapped objects so that you can do what you're asking. However, since we know that Submit will come back as a button, you should have no problem with just typing out the methods without using CodeCompletion.