-1
for product_name in self.mydriverOne.product_container.product_name:
    rt=product_name.text[:-1]
    print rt

I need to validate the variable rt is an integer value. How can I do it in selenium web driver using Python?

rtruszk
  • 3,902
  • 13
  • 36
  • 53

1 Answers1

-1

You have to use some python related coding for this. As you already have value in 'rt' which is probably is a string. Now you just have to check whether it contains numeric values. I mean whether string is like '1234'. Refer this : How do I check if a string is a number (float) in Python?

Also,

Checking whether a variable is an integer or not

Community
  • 1
  • 1
jain28
  • 137
  • 5
  • are there any way to solve this using Assertions in selenium ? – Husny Jiffry Sep 08 '15 at 08:00
  • I guess thing you are looking for is that variable "rt" has numeric values like "12345" etc. right? I am not sure about python but in java this again can be done: http://stackoverflow.com/questions/5439529/determine-if-a-string-is-an-integer-in-java – jain28 Sep 08 '15 at 08:35