Finding WebElements - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Finding WebElements (/Thread-Finding-WebElements) |
Finding WebElements - mv8167 - 06-29-2011 I am trying to get the WebElement of a WebTable that has 7 columns. I need the page numbher found in the 5th column.My code below returns no data. I can not figure why. Any thoughts? Code: Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All") RE: Finding WebElements - parminderdhiman84 - 06-29-2011 Hello Lorena, Just did some little changes in your script. When you know that you want the data of 5th column then no need to put an extra for loop for column Code: Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All") Regards, Parminder RE: Finding WebElements - mv8167 - 06-29-2011 Parminder, Thx for your help. With regards to your statement " no need to run the index loop also as you can debug on which index number the pages are coming and provide that index no in childitem method", I was trying to find all of the columns with WebElement to see if I find any of them. See screenshot. My GetROProperty does not seem to be able to dig down far enough to find the WebElements within the table. My code brings back the WebElements of the Links (that I do not want) but not of the objects that class are WebElements I tried your suggested code, but I rerceive a Run Error: Unspecified error Line (41): "ChildCountPage=TableObj.ChildItemCount(r, 5, "WebElement")". I also added screenshots of the OR of the webelements and vtable output. Thx again for your help. RE: Finding WebElements - parminderdhiman84 - 06-29-2011 Hello Lorena, If i understand right, then you need the data displayed in the Pages column. Please use the below code: Code: Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All") If still your problem is not solved then i will need the OR screenshot of webtable(Select All) with column and rows displayed. Regards, Parminder RE: Finding WebElements - mv8167 - 06-29-2011 Parminder, Wow! this works great. I was making a much bigger todo for nothing. I am curious why the code I do have wont dig down to find the WebElements of the columns (Account No, Receive Date, Desfription). I am receiving the following Run Error: Object required: 'TableObj.ChildItem(...)' Line (53): "NumPages = TableObj.ChildItem(r,5, "WebElement", k).GetROProperty("innertext")". I changed the ...(r, 5,.... to ...(r, c,.... to grab all of the page WebElements. The Run Aerror goes away but the data returned to the table only consists of thev DocType and Action columns. I must be pointing to the wrong table. Attached oin my previous chast is a screenshot of the OR. My code: Code: Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All") Code: For r = 1 to RowCount thx my friend ;-) RE: Finding WebElements - parminderdhiman84 - 06-30-2011 Hi Lorena, I cannot say why your code is not working as I dont have the application with me. But if you want to get all the items of the webtable then you can use below code: Code: Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All") Always use GetCellData if you want the data from any webtable cell. Use ChildItem method when one cell of webtable contains more than one value and you need index to get the desired value from that cell e.g. the last column of you webtable which contains 3 links, If you want to click any of these three links then you have to use childitem method. Regards, Parminder RE: Finding WebElements - mv8167 - 06-30-2011 Parminder Thx for the clarification. By this I know understand why my code did not grab what I thought it would. A super big thxxxx RE: Finding WebElements - parminderdhiman84 - 06-30-2011 Lorena, Its my pleasure if i could help you through this forum as it has helped me solve some of my problems. But you are welcome to ask anything you face problem with . Just let others also know about this forum to grow the forum and enrich the knowledge of others. Have a great day.. Regards, Parminder |