Frustrated with Random Numbers - Help :( - 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: Frustrated with Random Numbers - Help :( (/Thread-Frustrated-with-Random-Numbers-Help) |
Frustrated with Random Numbers - Help :( - Scanditester - 03-31-2009 Hi, Am quite new to this QTP and am just wondering how can I generate random numbers and let QTP click on that random number that got generated? Someone before me used the following to generate the random numbers: Code: Dim uniqueNumber and then he used the following: Code: row=Browser("ad1Domain").Page("ad1Domain_2").WebTable("EntryNewsletterRegistrationAdmin").GetRowWithCellText(CStr(uniqueNumber)) My problem is that the link in my case is randomly generated number. How can I tell Mr. QTP to find the random number generated and click it? Aaaah, this is killing me... RE: Frustrated with Random Numbers - Help :( - Scanditester - 04-01-2009 If no one understand how that is working then can someone tell me how to generate random numbers and tell QTP to click on that randomly generated number? Does that make it easier or..? RE: Frustrated with Random Numbers - Help :( - guilherme_br - 04-02-2009 I had that problem with random numbers some yeeks ago, I don't know if it's the same, but I think that this will help you. This video bellow is what I used to uderstand how to do that. http://motevich.blogspot.com/2008/08/qtp-regexp-how-to-click-dynamic-link.html If you have some questions, fell free to ask RE: Frustrated with Random Numbers - Help :( - Rachna - 04-02-2009 Hi , You can try if the below mentioned code works for you: Code: Dim bytes1(99), bytes2(99) As Byte -Rachna RE: Frustrated with Random Numbers - Help :( - guilherme_br - 04-06-2009 Hi Scanditester, I received your email. I'll try to explain that for you. If you watched the link that I put in my other post it will help you, anyway, I think that you need to do the following: *Save your script on QTP. *When you came to desired screen you can view it on QTP on "Active Screen" tab (View -> Active Screen). *There I think that you will see that random ID, highlight that and click with the right button on it and select the "Insert Text Output" option. *So, you can configure to pick that number you selected and store it on a table. That's what I did, in my case I want to pick that number and search in a Excel sheet this and fill the respective value. If your number is inside a WebTable you can do the following (I don't know if it works, I'm don't have much knowledge on QTP): *Do a CheckPoint in the table and select only the field that appears the random ID. *Parameterize that field, to receive the table that you stored the rendom ID. Well, sorry for the long post, I hope that can help you to solve that. Anyway, if you still has some doubts send me a message. Good luck RE: Frustrated with Random Numbers - Help :( - Scanditester - 04-06-2009 Thanks guilherme_br. I will try those steps. I did check the link out, but the problem is that in my case the ID number is not a link. Its just a simple text. I have attached two files. One that shows how the survey looks like and the other showing the table that QTP captures. I want QTP to know that a new survey has been created and also knows that the delete or edit button next to it is the right one. Hope it is more clear now? RE: Frustrated with Random Numbers - Help :( - Scanditester - 04-06-2009 Okei, now am getting the output value in the runtime datatable as attached. The challenges now are: - How do I make sure that this id exists in the WebTable for example? - Whenever a new survey is created, a new edit and delete buttons are created also. Each has a link with the id inside. How do I make sure that it is clicking the right delete button for example? Right now it is clicking delete on a certain row only. Here is my crappy code from a crappy script writer 'Adding survey here Code: Browser("Web Single Sign On").Page("ad1Domain").Link("Quick Surveys").Click Code: Browser("Web Single Sign On").Page("ad1Domain_4").WebElement("222").Output CheckPoint("222") Code: Browser("Web Single Sign On").Page("ad1Domain_5").WebElement("DELETE").Check CheckPoint("DELETE") RE: Frustrated with Random Numbers - Help :( - guilherme_br - 04-08-2009 *I think that everytime you create a new survey, it add a line in your WebTable, right? If that so, it's gonna be hard to check this. I think you could do some if's getting the number of the created survey from the table and trow to a variable. Based on your image, the new survey always gonna be on cell "A2" on your table. *Well, for this one I can't imagine what you could do, I guess that you can check the link and somehow pick that id and do some if's (again) comparing with the output value. Well, this probably can't help you so much. But if I had to do this I'll try something like that. Sorry if I can't help you more than that right now |