Python The truth value of a Series is enormous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Asked 2 years ago, Updated 2 years ago, 18 views

I'm comparing data frames with Python

 if not ((df['on']) == (driver.found_elements_by_class_name('bg_wrap')[0]):
            print ("Run")

If you compare selenium and dataframe, The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). This error appears. Does anyone know why?

python

2022-09-20 19:49

1 Answers

According to the Manual, find_elements_by_class_name('bg_wrap')[0] you will get one WebElement I think you need to get text in it and compare it?

if df['on'] != driver.find_elements_by_class_name('bg_wrap')[0].text :
    print ("Run")


2022-09-20 19:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.