dimanche 15 février 2015

Python Unittest - If assertEqual then?

I have used the Selenium IDE to record a "perfect" scenario for some datamining I am doing, I have exported the script to Python Unittest, and out-of-the box it works fine.


How ever I want to run over a table, and if a value on a particular field matches a text, I would like to test if the content in another field within the same row is not equal to "NULL". The mapping of the fields is done. But I am having trouble testing for the equality to get the logic working..


Ideally I want to do something like this, but this is not working:



if self.assertEqual("FOO", driver.find_element_by_xpath("//div[@id='passedindata']/table/tbody/tr/td[2]/div[3]/div/table/tbody/tr[13]/td[8]").text):
self.assertNotEqual("NULL", driver.find_element_by_xpath("//div[@id='passedindata']/table/tbody/tr/td[2]/div[3]/div/table/tbody/tr[13]/td[3]").text)

Aucun commentaire:

Enregistrer un commentaire