Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
stop cycle while
#2
Why would you expect the while loop to end? "while True" runs forever and there is no code to break out of the while. You could try writing your code like this:
try:
    while True :
        element1=driver.find_element_by_xpath(f[i])
        driver.find_element_by_xpath(f[i]).click()
        import time
        time.sleep(1)
except ValueError:
    print("no more clicks")
Reply


Messages In This Thread
stop cycle while - by windows11 - May-16-2020, 02:42 PM
RE: stop cycle while - by deanhystad - May-16-2020, 03:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Writing a cycle to find the nearest point from the array Tysrusko 0 191 May-10-2024, 11:49 AM
Last Post: Tysrusko
  Need to fix SyntaxError in cycle try alexfrol86 14 3,297 Mar-27-2022, 07:53 AM
Last Post: stevendaprano
  Trying to cycle through a list of charcters pooky2483 12 4,642 Sep-28-2020, 06:55 AM
Last Post: pooky2483
  <while> cycle is not interrupted when using the <random>module ShityCoder 3 2,248 Sep-04-2020, 04:05 PM
Last Post: ShityCoder
  Cycle of numpy variables Zero01 0 1,586 Jul-31-2020, 11:58 AM
Last Post: Zero01
  Occurrences using FOR and IF cycle P86 2 2,571 Jul-29-2019, 04:37 PM
Last Post: ThomasL
  pool map cycle skorost5 5 3,903 Apr-07-2019, 09:21 AM
Last Post: skorost5
  lifetime cycle counter Ixxxxxx 0 2,524 Mar-07-2018, 07:26 PM
Last Post: Ixxxxxx

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020