lundi 9 novembre 2020

Fetching console log response for every select option tag using python and selenium

So basically as the title says I'm trying to fetch log response for every option from select tag and display those logs. When I try this approach using selenium with python I only getfirst two logs for the first 2 options..

selects = driver.find_element_by_name("documentType")
selecting = Select(selects)
##### FIRST OPTION
selecting.select_by_index(0)
data = driver.get_log('browser')
time.sleep(2)
print(data)
####SECOND OPTION
selecting.select_by_index(1)
data = driver.get_log('browser')
time.sleep(2)
print(data)
###THIRD OPTION
selecting.select_by_index(2)
data = driver.get_log('browser')
time.sleep(2)
print(data)

My question is why am I getting logs for the first two options but not for the third. How can I overcome this issue because when I switch the order let'say I select second option primarly and then the third and the first option ,it would log only second and the third option, but not the first one.

Aucun commentaire:

Enregistrer un commentaire