The result is false in the conditional statement (==) that determines whether the text imported from appium is the same as the previously declared value.

Asked 2 years ago, Updated 2 years ago, 16 views

I am automating the Android APP app UI with appium. It turns a conditional statement that determines whether the text obtained from appium and the declared value in the script are the same Continue to judge false.

#declare values to compare
bar_da = "9300647000342"
Extract text from #appium
scan_da = driver.find_element (By.XPATH, "I'll skip the XPATH path").text
#Determine if the value is the same as the conditional statement
 if scan_da == bar_da:
     # Data matching increases scan success
     ss = ss + 1
else:
     # Data mismatch increases inconsistency
    nm = nm + 1

Running a conditional statement increases the value of nm by 1.

I took a picture of the value and type of the variable and checked it.

print("scan_da")
print(type(scan_da))
print(scan_da)
print("bar_da")
print(type(bar_da))
print(bar_da)

As shown below, the type and the value are all taken.

scan_da
<class 'str'>
9300647000342

bar_da
<class 'str'>
9300647000342

python

2022-09-20 11:06

1 Answers

Does converting to int object produce the same result?

if int(scan_da) == int(bar_da):


2022-09-20 11:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.