美文网首页我爱编程
selenium 操作下拉框

selenium 操作下拉框

作者: 小强很帅 | 来源:发表于2017-12-18 09:43 被阅读150次

selenium操作下拉框的两种方法:

第一种就是普通的select 形式的用 tag name 去定位

log_Type = Select(dr.find_element_by_tag_name('select')).select_by_index(26)

第二种是div形式的下拉框

#先定位到下拉框

m=dr.find_element_by_xpath('//*[@id="componentsCombo"]').click()

time.sleep(3)

#再点击下拉框下的选项

dr.find_element_by_xpath('//*[@id="ext-gen34"]/div[3]').click()

dr.find_element_by_xpath('//[@id="pvBody_PageTemplate_innerHolder_ObjDetails_PassContent_MultpleConnectButton"]').click()

如果生成不了测试报告,是因为编辑器默认执行篮框里的

相关文章

网友评论

    本文标题:selenium 操作下拉框

    本文链接:https://www.haomeiwen.com/subject/ieupwxtx.html