Google 环聊起始页上显示“+ 添加电话”的页面元素的名称是什么?
What is the name of the page element that reads "+ Add telephone" on the Google Hangouts start page?
我正在寻找在 Google Hangouts start page 上显示为“+ 添加电话”的页面元素的名称,以便将其插入 Selenium Python API 的 webdriver.Firefox().find_element_by_name()
命令。
或者,元素 ID 也可以,因为我知道还有一个 find_element_by_id()
命令。
该元素没有任何名称。寻找 xpath 包含函数并使用 find_element_by_xpath
//div[contains(text(),'Add telephone')]
但是,最好不要使用 Google 进行任何类型的测试。那是一种陷阱。专为 Selenium
检查元素(使用Google Chrome),它看起来像这样:
<div class="c-N-K c-za-b ZG Kn-Mo" role="button" tabindex="0" style="-webkit-user-select: none;">+ Add telephone</div>
该元素上没有 name
或 id
。但它包含在具有独特 id
!
的 span
中
<span id=":sb.og">
<div class="c-N-K c-za-b ZG Kn-Mo" role="button" tabindex="0" style="-webkit-user-select: none;">+ Add telephone</div>
</span>
或者,正如@Saifur 指出的那样,您也可以通过文本查找。
我正在寻找在 Google Hangouts start page 上显示为“+ 添加电话”的页面元素的名称,以便将其插入 Selenium Python API 的 webdriver.Firefox().find_element_by_name()
命令。
或者,元素 ID 也可以,因为我知道还有一个 find_element_by_id()
命令。
该元素没有任何名称。寻找 xpath 包含函数并使用 find_element_by_xpath
//div[contains(text(),'Add telephone')]
但是,最好不要使用 Google 进行任何类型的测试。那是一种陷阱。专为 Selenium
检查元素(使用Google Chrome),它看起来像这样:
<div class="c-N-K c-za-b ZG Kn-Mo" role="button" tabindex="0" style="-webkit-user-select: none;">+ Add telephone</div>
该元素上没有 name
或 id
。但它包含在具有独特 id
!
span
中
<span id=":sb.og">
<div class="c-N-K c-za-b ZG Kn-Mo" role="button" tabindex="0" style="-webkit-user-select: none;">+ Add telephone</div>
</span>
或者,正如@Saifur 指出的那样,您也可以通过文本查找。