write a function to run the same row in excel
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
write a function to run the same row in excel
I have a cell which contain a value i excel. If that value fails then i need to click ok on the screen and run the previous row in t he excel again. How to write a VB script function for it.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
assuming that you are working with excel DDT drive you can not go back in the loop.
technically this is not TC limitation it is Ms-excel limitation.
But you can use different technique , store previous row in an array https://www.w3schools.com/asp/func_array.asp
0) define an array before you call DDT drive
1) in your loop just before Call Driver.Next() , store your XL values in array
2) In your xl values processing area put an IF condition like... if fails use array values.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I concur that, if you need to re-use values of the current row for some reason, simply store those values in some structure (object, array, variables, external file, etc)... that is if you need to cycle back through. However, as long as you are still in the same iteration of the DDT loop, then you can just keep re-using the values until the loop recycles.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
row no | status | function | Value |
4 | enable | validate value in table | abcd |
5 | enable | click button |
If row table value validation fails then i want to write a function like the below one
If Validate value in table = err |
click ok on the message box |
click ok again on the screen |
then go to row 4 and validate the value again |
Is this possible in VB script? Ours is keyword driven
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The short answer is: yes. Basically, while you're within the same loop, there's no need to "go to row 4". You're already on row 4, you just exercise your logic as you have it written. Until you go back through the loop a second time, the values in the current row (row 4) are still available to you.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i=0// intializing i because err may find any row inside the table
while (table= err)
button1.click()
button2.click()
if message box. exist then // some scenario's a meaasge box appears
checkbox.click()
button3.click()
end if
wend
i=i+1
1.if implemented this and the if statement is not getting executed.
2.if i comment the if statement the loop goes on and never ends
somewhere i go wrong
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While I appreciate the use of pseudo-code to get across concepts, it is next to impossible to debug logic problems without knowing the exact code. Variables may be set wrong, methods may be used improperly, etc. Please, if you can, share your exact code... or, if nothing else, something that as closely resembles your exact code as much as possible.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
