Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global dropdown_counter
- dropdown_counter = 1
- global str_counter
- str_counter = str(dropdown_counter)
- global dropdown_link
- def open_dropdowns(xpath):
- for _ in range(23):
- str_counter = str(dropdown_counter)
- dropdown_link = '/html/body/div[1]/div/div[2]/div/div/div[2]/div[1]/nav/div/div/div/div/div[2]/ol/li[' + str_counter + xpath
- driver.find_element_by_xpath(dropdown_link).click()
- dropdown_counter +=1
- dropdown_counter = 1
- open_dropdowns(']/span/button')
- open_dropdowns(']/ol/li[1]/span/button')
- '''
- I defined all the variables as global but im still getting this error
- Traceback (most recent call last):
- File ".\ustech.py", line 58, in <module>
- open_dropdowns(']/span/button')
- File ".\ustech.py", line 53, in open_dropdowns
- str_counter = str(dropdown_counter)
- UnboundLocalError: local variable 'dropdown_counter' referenced before assignment
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement