My tests are comparing two values to make sure value getting from locator should not be less or equal to expected value.

Expected value returning from element.getText method is (0.00, 0.00) and actual value is (0.82, 0.43). These are tuples but element.getText method is returning string. If I use get_attribute("innerHTML") it's returning (u'(', u'0', u'.', u'8', u'2', u',', u' ', u'0', u'.', u'4', u'3', u')')

Not sure what to use, element.getText or get_attribute("innerHTML")?


I think you can just converta tuple to a string and compare them:

# Python3 code to convert tuple  
# into string 
def convertTuple(tup): 
    str =  ''.join(tup) 
    return str

# Driver code 
tuple = ('g', 'e', 'e', 'k', 's') 
str = convertTuple(tuple) 

Source: https://www.geeksforgeeks.org/python-program-to-convert-a-tuple-to-a-string/

| improve this answer | |
  • Thanks for the reply Neils van..I'm sorry abu this I will make sure to post relevant questions only. – Sara Oct 8 '19 at 12:22
  • 1
    Np Stack Exchange network is broad and has a lot of different sites with different topics. For you this is a testing question, while for others it is a programming question. Dont feel bad when we close it, just ask again on the right site :) – Niels van Reijmersdal Oct 8 '19 at 13:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.