天天看點

selenium.common.exceptions.InvalidSelectorException: Message: Compound class names not permitted元素定位

使用class_name進行定位元素,出現錯誤提示:

selenium.common.exceptions.InvalidSelectorException: Message: Compound class names not permitted

代碼如下圖:

selenium.common.exceptions.InvalidSelectorException: Message: Compound class names not permitted元素定位

菜鳥不懂這個錯是什麼意思,百度翻譯了一下,是不允許複合型class_name,沒想明白什麼意思,後來找到資料,

如上圖我找的這個class_name是btn radius size_L btn-danger

這是個複合型的,這個錯誤解決辦法是直接選擇一個name就可以,如下圖:

selenium.common.exceptions.InvalidSelectorException: Message: Compound class names not permitted元素定位

隻寫其中一個name就可以了!

繼續閱讀