diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-11-08 22:16:50 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-11-08 22:16:50 +0100 |
commit | 49b7c644c0e0136bdae454df67a3e385d63babda (patch) | |
tree | 49e13a35f9ae59b64f0f7f2605e6c8078568c598 | |
parent | a4c073bfa4ed46f8173d5523cae9e46278a22452 (diff) |
selenium: fixing up to make_donation. Fail due to #4762
-rw-r--r-- | selenium/test.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/selenium/test.py b/selenium/test.py index aa958efa5..c8ee061e4 100644 --- a/selenium/test.py +++ b/selenium/test.py @@ -69,7 +69,7 @@ def switch_base(): if url[1] == 'demo.taler.net': taler_baseurl = "https://test.taler.net" -def make_donation(client, amount_value=None): +def make_donation(client, amount_menuentry=None): """Make donation at shop.test.taler.net. Assume the wallet has coins""" client.get(parse.urljoin(taler_baseurl, "shop")) try: @@ -77,11 +77,17 @@ def make_donation(client, amount_value=None): except NoSuchElementException: logger.error('No donation form found') sys.exit(1) - if amount_value: - xpath = "//select[@id='taler-donation']/option[@value='" + str(amount_value) + "']" + if amount_menuentry: + xpath_menu = '//select[@id="taler-donation"]' try: - desired_amount = client.find_element(By.XPATH, xpath) - desired_amount.click() + dropdown = client.find_element(By.XPATH, xpath_menu) + for option in dropdown.find_elements_by_tag_name("option"): + # Tried option.text, did not work. + if option.get_attribute("innerHTML") == amount_menuentry: + option = WebDriverWait(client, 10).until(EC.visibility_of(option)) + logger.info("Picked donation %s" % option.text) + option.click() + break except NoSuchElementException: logger.error("value '" + str(amount_value) + "' is not offered by this shop to donate, please adapt it") sys.exit(1) @@ -245,7 +251,7 @@ logger.info("Withdrawing..") withdraw(client, "10.00 PUDOS") # switch_base() # inducing error logger.info("Making donations..") -make_donation(client, 6.0) +make_donation(client, "1.0 PUDOS") logger.info("Buying article..") buy_article(client) logger.info("Test passed") |