我在网站中有一个数字字段,我想保存它的值,假设它是150我想做的是,如果新数字比它的旧值打印";是的,它很大;
num = driver.find_element_by_id("numField")
# and then some clicks and instructions and some changes in its value
if num>num:
print("yes it's big")
您可以再次获得该元素的新值,然后在值之间进行比较
我认为您想要提取元素文本
如果是这样,您的代码可能是这样的:
initial_num = driver.find_element_by_id("numField").text
# and then some clicks and instructions and some changes in its value
new_num = driver.find_element_by_id("numField").text
if new_num>initial_num:
print("yes it's big")