1

I have the following click even within a loop that works but i only want it to be carrie out on the first loop as after that the javascipt has been activated

browser.find_element_by_xpath("//*[@id='re_']/div[2]/a[1]").click()

any ideas how i can do this?

2
  • 1
    include that for loop in your question Commented Jun 3, 2016 at 10:36
  • 1
    Include what sorry? Commented Jun 3, 2016 at 10:48

1 Answer 1

2

have some counter

count = 0

loop.....
    if count == 0:
        browser.find_element_by_xpath("//*[@id='re_']/div[2]/a[1]").click()
        count = count + 1
    rest of the code

only the first time the loop runs, the button will be clicked

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.