Retaki Posted March 27, 2020 Share Posted March 27, 2020 Hello, hope you are doing well I will try to be short and to the point, am trying to automate chrome to do a specific task, i have access to a web page that open another window inside the same parent window (not separated tap), i can successfully automate the steps needed to open that popup. the issue here that there is a table inside that popup that am trying to deal with, the table is 4 columns and unknown rows number cause it will be dynamically allocated based on selected parent item. Whatever, am trying to look for specific text inside the third column but am not certain about which row it may exist. So, my question is how i can search for this cell using x Path? Here is table html code expandcollapse popup<table id="settings_object_sensor_list_grid" class="table table-bordered table-hover table-responsive dataTable no-footer" role="grid" aria-describedby="settings_object_sensor_list_grid_info" style="width: 100%;"> <thead> <tr role="row" style="height: 0px;"> <th class="sorting_disabled" rowspan="1" colspan="1" style="width: 222px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"> <div class="dataTables_sizing" style="height:0;overflow:hidden;">Name</div> </th> <th class="sorting_disabled" rowspan="1" colspan="1" style="width: 221px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"> <div class="dataTables_sizing" style="height:0;overflow:hidden;">Type</div> </th> <th class="sorting_disabled" rowspan="1" colspan="1" style="width: 141px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"> <div class="dataTables_sizing" style="height:0;overflow:hidden;">Parameter</div> </th> <th class="sorting_disabled" rowspan="1" colspan="1" style="width: 146px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"> <div class="dataTables_sizing" style="height:0;overflow:hidden;">Operations</div> </th> </tr> </thead> <tbody> <tr role="row" class="odd" id="ACC"> <td>ACC</td> <td>Ignition (ACC)</td> <td>di5</td> <td><a href="#" onclick="gsSettings.sensorsDialog('244279');" title="Edit"><i class="fa fa-edit fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsDelete('244279');" title="Delete"><i class="fa fa-trash-o fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsClone('244279');" title="Clone to other objects"><i class="fa fa-trash-o fa-lg fa-clone"></i></a></td> </tr> <tr role="row" class="even" id="Weight"> <td>Weight</td> <td>WEIGHT</td> <td>ai4</td> <td><a href="#" onclick="gsSettings.sensorsDialog('244829');" title="Edit"><i class="fa fa-edit fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsDelete('244829');" title="Delete"><i class="fa fa-trash-o fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsClone('244829');" title="Clone to other objects"><i class="fa fa-trash-o fa-lg fa-clone"></i></a></td> </tr> <tr role="row" class="odd" id="Volt"> <td>Volt</td> <td>Custom Low High</td> <td>ai4</td> <td><a href="#" onclick="gsSettings.sensorsDialog('244831');" title="Edit"><i class="fa fa-edit fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsDelete('244831');" title="Delete"><i class="fa fa-trash-o fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsClone('244831');" title="Clone to other objects"><i class="fa fa-trash-o fa-lg fa-clone"></i></a></td> </tr> <tr role="row" class="even" id="BATTERY STATUS"> <td>BATTERY STATUS</td> <td>Custom</td> <td>di8</td> <td><a href="#" onclick="gsSettings.sensorsDialog('245869');" title="Edit"><i class="fa fa-edit fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsDelete('245869');" title="Delete"><i class="fa fa-trash-o fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsClone('245869');" title="Clone to other objects"><i class="fa fa-trash-o fa-lg fa-clone"></i></a></td> </tr> </tbody> </table> Notice here there is a 3button inside the 4th column And am trying to access it using the common _WD_FindElement function. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@id='dialog_settings_object_edit']//table[@id='settings_object_sensor_list_grid']//tr[@id='Volt']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sElement & "//tr[@id='Volt']//td//a[@title='Edit']") If @error = $_WD_ERROR_SUCCESS Then _WD_ElementAction($sSession, $sElement, 'click') EndIf ConsoleWrite(@error & @CRLF) I hope that i clarified enough, looking for help, thank you. Link to comment Share on other sites More sharing options...
Danp2 Posted March 27, 2020 Share Posted March 27, 2020 You may want to check out _WD_GetTableContent written by @danylarson. I believe the latest version can be found here. P.S. Some variation of this will likely make it into a future version of the UDF. I just haven't made the time to test this out thoroughly. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Retaki Posted March 27, 2020 Author Share Posted March 27, 2020 May you please share an example cause am stuck using it correctly? Link to comment Share on other sites More sharing options...
Retaki Posted March 28, 2020 Author Share Posted March 28, 2020 @Danp2 Thank you for supporting me, i completed my task and now it works successfully, thank you again for your Web Driver and support Link to comment Share on other sites More sharing options...
Danp2 Posted March 28, 2020 Share Posted March 28, 2020 You're welcome... and glad you were able to figure it out on your own. Latest Webdriver UDF Release Webdriver Wiki FAQs 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