lundi 27 novembre 2017

How to check if any alert is present on Selenium test with function subTest

Q: What i need? A: I need to check ANY alert is present, if user click on <a href="#"> to remove row on table. I cant use "Try-except" feature for Selenium test. I need something like:

with self.subTest('Testing alert in transaction {}'.format(value['link'])):
driver.find_element_by_xpath('//table/tbody/tr[1]/td[last()]/a/i[@class="fa fa-remove"]').click()
self.assertTrue(EC.alert_is_present(), 'Alert is present')

EC.alert_is_present()

What operator i can use to check alerts?

Aucun commentaire:

Enregistrer un commentaire