jeudi 20 octobre 2016

proper way to tick a checkbox in selenium?

I want to tick a checkbox in a selenium test using python. The test passes all times when I run it on my local machine, and fails all times when I run it using shippable. The test runs in a docker container, so there should not be any difference. The code:

def tickCheckbox(self, elementId):
    self.logAction('<tickCheckbox fieldid="{0}">'.format(elementId))
    element = TE.driver.find_element_by_id(elementId)
    element.send_keys(Keys.SPACE)
    print elementId
    selected = False
    for t in range(10):
        time.sleep(1)
        print "slept"
        if element.is_selected():
            selected = True
            break
    self.assertTrue(selected)

On shippable it fails on the last line.




Aucun commentaire:

Enregistrer un commentaire