I’ve a state of affairs, which I’m discovering bit tough to automate.
The check state of affairs is :
There are two drop down.
- To pick out the state.
- To pick out the respective cities.
So, I would like to put in writing a script to automate, the place I would like to pick a state from State drop down and for that state I would like to pick all of the cities one after the opposite. As soon as all of the cities are chosen for that respective state, I would like to come back out of that loop and choose a unique state and repeat this course of.
That is the code which i’ve written.
def test_state(self):
aspect = self.getAllTheElements(self.Register_page_elements,'xpath', 'choice')
for hyperlink in aspect:
if hyperlink.get_attribute('worth'):
hyperlink.click on()
print("check")
time.sleep(4)
aspect = self.getAllTheElements('autocomplete-city', 'id', 'choice')
for link2 in aspect:
if link2.get_attribute("worth"):
link2.click on()
print("state")
time.sleep(2)
Since I’ve not given break assertion, it’ll throw an error after finishing whole iteration.
However, if I give a break it wont work the way in which I would like.
That is the HTML code of the drop down.
For state.
As soon as I choose the state then town drop down will seem.
