我是新的硒,想用它来测试登录页。我有下面的文本字段,我想在其中插入用户名。你知道吗
<div class="WODM WNDM" data-automation-id="userName">
<div class="gwt-Label WBEM">Email Address</div><input type="text"
class="gwt-TextBox WAEM" autocapitalize="none" autocorrect="off"
autocomplete="off" aria-label="Email Address" dir="ltr">
</div>
我写了以下代码,但它不起作用:
emailElem = driver.find_element_by_class_name('gwt-Label WBEM')
emailElem.send_keys('some_email')
提前谢谢!你知道吗
我能看到三件事:
clear()
。你知道吗gwt-Label
和WBEM
,这是一个<label></label>
-你不应该调用<input></input>
,它有两个类:gwt-TextBox
和WAEM
因此,考虑到这三点,您应该将代码更改为:
可以使用xpath,如下所示
相关问题 更多 >
编程相关推荐