【发布时间】:2016-09-17 05:24:51
【问题描述】:
我正在尝试让 selenium 等到能够在页面上找到某个类,我尝试了几位代码但没有任何效果
尝试以下方法:
while not firefox.find_element_by_css_selector('.but selected'):
print "test"
time.sleep(1)
返回
selenium.common.exceptions.NoSuchElementException: 消息:无法定位元素
尝试以下方法:
while not firefox.find_element_by_class_name('but selected'):
print "test"
time.sleep(1)
返回:
selenium.common.exceptions.InvalidSelectorException:消息:给定的选择器,但被选中,要么无效,要么不会产生 WebElement。发生以下错误: InvalidSelectorError:不允许复合类名
知道我做错了什么以及如何解决吗?
【问题讨论】:
标签: python python-2.7 selenium