iamtech Posted May 6, 2018 Share Posted May 6, 2018 I want to click on IE Button using Index number, Because it have same id, and i am not able to click on using text becuase text is change every time. My Source code is : <table class="table table-hover table-bordered"> <tr title="" id="btnselect" onclick="functionSubmit(Random,1,'Random','Random','Random');" data-original-title="Please Select One" data-toggle="tooltip" data-placement="bottom"> <tr title="" id="btnselect" onclick="functionSubmit(Random,2,'Random','Random','Random');" data-original-title="Please Select One" data-toggle="tooltip" data-placement="bottom"> <tr title="" id="btnselect" onclick="functionSubmit(Random,3,'Random','Random','Random');" data-original-title="Please Select One" data-toggle="tooltip" data-placement="bottom"> <tr title="" id="btnselect" onclick="functionSubmit(Random,4,'Random','Random','Random');" data-original-title="Please Select One" data-toggle="tooltip" data-placement="bottom"> I want to click on third 'btnselect'. Link to comment Share on other sites More sharing options...
rootx Posted May 6, 2018 Share Posted May 6, 2018 One way .... use _IETagnameGetCollection with tr tag, than put a counter inside a loop for next, and read the exact values, in your array is $btnselect [2]. Link to comment Share on other sites More sharing options...
iamtech Posted May 16, 2018 Author Share Posted May 16, 2018 On 5/6/2018 at 7:54 PM, rootx said: One way .... use _IETagnameGetCollection with tr tag, than put a counter inside a loop for next, and read the exact values, in your array is $btnselect [2]. @rootx How can i use this? Please post example Link to comment Share on other sites More sharing options...
junkew Posted May 16, 2018 Share Posted May 16, 2018 Check help will help https://www.autoitscript.com/autoit3/docs/libfunctions/_IETagNameGetCollection.htm FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
iamtech Posted May 24, 2018 Author Share Posted May 24, 2018 On 5/16/2018 at 11:18 PM, junkew said: Check help will help https://www.autoitscript.com/autoit3/docs/libfunctions/_IETagNameGetCollection.htm @junkew it was showing text inside tr code, my question is how to click on it if same text, same id, same tittle. Link to comment Share on other sites More sharing options...
rootx Posted May 24, 2018 Share Posted May 24, 2018 5 minutes ago, iamtech said: @junkew it was showing text inside tr code, my question is how to click on it if same text, same id, same tittle. Post your code before. Link to comment Share on other sites More sharing options...
iamtech Posted May 24, 2018 Author Share Posted May 24, 2018 6 minutes ago, rootx said: Post your code before. I have no any code about this, because i am new for autoit Link to comment Share on other sites More sharing options...
junkew Posted May 24, 2018 Share Posted May 24, 2018 Click by index or instance and in uiautomation udf i also made indexrelative to another object. And with collections it is as given above or iterate over the collection. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
iamtech Posted May 27, 2018 Author Share Posted May 27, 2018 How can i click on third button if button have same id? <table class="table table-hover table"> <tr title="" id="btnselection" onclick="functionSubmit(Random,1,'Random','Random','Random') <tr title="" id="btnselection" onclick="functionSubmit(Random,2,'Random','Random','Random') <tr title="" id="btnselection" onclick="functionSubmit(Random,3,'Random','Random','Random') ;i want to click on this button <tr title="" id="btnselection" onclick="functionSubmit(Random,4,'Random','Random','Random') Link to comment Share on other sites More sharing options...
seandisanti Posted May 27, 2018 Share Posted May 27, 2018 Technically they shouldn't have the same ID, but that's fine. How do you know which one to click on while looking at the page? if you're really just going based on index, you can use IETagNameGetCollection() to return a collection of elements with that tag and then step through them until you find the one you're looking for. Link to comment Share on other sites More sharing options...
iamtech Posted May 27, 2018 Author Share Posted May 27, 2018 6 hours ago, seandisanti said: Technically they shouldn't have the same ID, but that's fine. How do you know which one to click on while looking at the page? if you're really just going based on index, you can use IETagNameGetCollection() to return a collection of elements with that tag and then step through them until you find the one you're looking for. @seandisanti i want to click on third row of my table Link to comment Share on other sites More sharing options...
Danp2 Posted May 27, 2018 Share Posted May 27, 2018 @iamtech You have been referred to _IETagNameGetCollection multiple times, yet you haven't shown any effort on your part to solve the problem. You can't expect us to write your code for you. Please make an effort to solve this on your own. There are plenty of examples of using _IETagNameGetCollection (both in the help file and on this forum). Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 27, 2018 Moderators Share Posted May 27, 2018 @iamtech stick to one thread per topic. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now