Replies: 1 comment
-
If page remove or replace the element it can happen. You need to reselect the element on each loop |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a func, in this func i have a for loop.
The for loop goes through a hashmap with the key and elements being a *rod.Element and the element being a string (item description).
Now. when this for loop runs, there is an if statement, this checks to see if the element contains a string, if so, it runs a func enterRaffle(), if not it deletes the current key and element from the hashmap.
The enterRaffle() clicks on the button by using the rod.Element (this is called pageE), and then after a sleep it goes back to the current webpage (by page.Navigate(url).
My issue now is, this all works fine the first time around, however when it runs again (cause perhaps the if statement is true more than once as the element does contain a string more than once) it throws an error:
panic: cannot find object: {"type":"object","subtype":"node","className":"HTMLDivElement","value":null,"description":"div#plp-item-2933.ProductCard__ProductCardSC-sc-1dh591-0.MvzxY","objectId":"{\"injectedScriptId\":5,\"id\":12}"}
I have tried making new variables/double checking them , and even double checking the addresses which are different (for pageE (the rod element)).
a go playground of it can be found here: https://play.golang.org/p/E6BsoY0tfFy
Thanks
Beta Was this translation helpful? Give feedback.
All reactions