How can i change the 0 to be a variable that i can increase the value of when i loop the code
javaScript = "document.getElementsByTagName('cite')[0].click();"
browser.execute_script(javaScript)
in python you could do this :
i = 0
javaScript = f"document.getElementsByTagName('cite')[{i}].click();"
browser.execute_script(javaScript)
I'm not sure how you want to iterate
, but a standard way would be something like this :
i = 0
for x in range(5):
javaScript = f"document.getElementsByTagName('cite')[{i}].click();"
driver.execute_script(javaScript)
i = i + 1