| || |
Handling Multiple webtables in a page without adding them to OR
In an interview i was asked How to handle webtables in below scenario...
If in a web page there are many tables suppose 100 which has 2 columns Name and marks i have to search for a name suppose Daniel and write 100 in marks column which is a webedit.
As so many tables are there i cant add them to OR. So can someone tell me logic or code for this.
Thanks in advance
There are 3 approaches, (tool independant)
1) descriptive programming - which I'm lumping in things like xpath, jquery selectors, or other deep find operation.
2) object mapping with envionrment variables - Most tools that support object mapping, will allow you to do something like text=$ENV_VAR1, then substitute the env var at run time and do a Object Map refersh.
3) selecting the larger chunck, then filtering down - Map the table it self, then select all the rows into an array, then filter the array down to the target element.
Many thanks for the valuable inputs David. ith the above help I'm able to locate the name but when it comes to set the value in the adjacent web edit box i couldn't figure it out... Suppose if i find the value Daniel in table at 8,1 then I have to set 100 in 8,2 how can i do that...
When you find the label, you'll want to go up 2 parents. Usually in a typical table/grid view, the label is inside a cell. So if you grab the parent, you'll get a reference to that cell, then grab it's parent, you'll get a reference to the row. From the row, you can then search the children for the corresponding edit box since it'll be buried inside another cell within that same row. You'll want to use an object tree inspector to view the parent/child relationships of the items inside that row.
You can use any one of the approaches as mentioned by david
Set WebEditObj = Browser("Bname").Page("Pname").WebTable("Tablename ").ChildItem(rowno, colno, "WebEdit", Index)
Thanks for sharing inputs.
Originally Posted by dlai