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
  Assigning cycle values in a list nmancini 3 974 Sep-16-2024, 09:35 PM
Last Post: deanhystad
  Writing a cycle to find the nearest point from the array Tysrusko 0 773 May-10-2024, 11:49 AM
Last Post: Tysrusko
  Need to fix SyntaxError in cycle try alexfrol86 14 5,775 Mar-27-2022, 07:53 AM
Last Post: stevendaprano
  Trying to cycle through a list of charcters pooky2483 12 6,397 Sep-28-2020, 06:55 AM
Last Post: pooky2483
  <while> cycle is not interrupted when using the <random>module ShityCoder 3 3,009 Sep-04-2020, 04:05 PM
Last Post: ShityCoder
  Cycle of numpy variables Zero01 0 2,049 Jul-31-2020, 11:58 AM
Last Post: Zero01
  Occurrences using FOR and IF cycle P86 2 3,278 Jul-29-2019, 04:37 PM
Last Post: ThomasL
  pool map cycle skorost5 5 4,932 Apr-07-2019, 09:21 AM
Last Post: skorost5
  lifetime cycle counter Ixxxxxx 0 3,178 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