Question
PricewaterhouseCoopers LLP
US
Last activity: 23 Apr 2019 17:51 EDT
Making the code more manageable
Hi TEam,
I have a quick question. I have a web page which I am trying to interrogate. The applicable has been designed in a way that we are there are two versions of this same page. THey look exactly the same but it seems its under a different page. SO when I interrogate I have two tables. I have to take the data and put into excel in a specific format. So I have a bunch of Get and Set blocks one after the other for the table .Now to handle the second page I have to configure the same code again and again. Is there a way I can store the Dom table contents in a temporary table so that I can just have the temp table filled in conditionally and the big block of data copy module won't have to be repeated. Appreciate if you are able to review and provide some solutions quickly.
***Edited by Moderator Marissa to update platform capability tags****
If one table is on one page and the other table is on the same page but within a frame, then you should be able to interrogate that page using the Global Web Page option and it should match either within the frame or not. I suspect however, that this second table is on a different page and not within a frame, as the Use Global Web Page is normally checked. If that is the case, then it really is a second table no matter how similar it is to the first. You'd need to handle it as a separate object. The good news is though that you can call GetTable() on a table section to extract a DataTable object representing the table section. You could write your logic against this object, that way you have a single automation to extract data from either table. That automation could accept that DataTable as an input.