Quantcast
Channel: Silk Performer
Viewing all articles
Browse latest Browse all 4084

Forum Post: RE: browsercheckbox alternative

$
0
0
OK I understand now.  You need to write some code to search the grid for the keyword and then click it when found: Assuming it will always be in the same column, but in different rows you should do the following: Identify a non-descriptive locator where you can simply increment an index to move between rows. Get the text of each row and compare it with your keyword. If it matches then you have identified that rows locator so pass the locator into the BrowserCheckBoxSelect function. If it doesn;t match move on to the next row and try again. here's a sample you can run but bear in mind the BrowserCheckBoxSelect will fail as the row has no checkbox, its just for demonstration purposes. dcltrans  transaction TMain  var     wnd1, i, nResult: number;     sText : string;  begin    BrowserStart(BROWSER_MODE_DEFAULT, 1280, 600);    BrowserSetReplayBehavior(SP_15_5);    wnd1 := BrowserGetActiveWindow("wnd1");    BrowserNavigate(" demo.borland.com/.../explorer.html ; );    for i := 1 to 12 do // 12 is the number of rows    BrowserGetText("//table[@border='0']["+string(i)+"]/tbody[@aria-level='0']/tr[@aria-level='0']/td[@aria-level='0']/div[@aria-level='0']", sText);    // perform case insensitive comparison for keyword    nResult := Strnicmp(sText, "Level 3 Communications, Inc.", 20);      if nResult = 0 then // result of 0 means identical strings, anything else is not identical        Print("Found at row: "+string(i));        Print("//table[@border='0']["+string(i)+"]/tbody[@aria-level='0']/tr[@aria-level='0']/td[@aria-level='0']/div[@aria-level='0']");        exit;      end;    end;    // our sample doesn't have a checkbox but if it did this would click it.    BrowserCheckBoxSelect("//table[@border='0']["+string(i)+"]/tbody[@aria-level='0']/tr[@aria-level='0']/td[@aria-level='0']/div[@aria-level='0']", CHECKBOX_CHECKED);  end TMain; There are many different ways of achieving the same goal using BrowserFind, BrowserGetProperty etc.  

Viewing all articles
Browse latest Browse all 4084

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>