我试图通过Xpath()传递string的值来查找元素,以获得对属性值部分的搜索和匹配。我该怎么做
我在Python3.7和selenium库上试过,找不到从循环传递值的方法。我尝试了以下几点,但是没有成功
datasets = [ 'ds_pos_retail_outlet','ds_pos_retail_fullset', 'ds_pos_retail_ProfitCenter','ds_pos_retail_Section']
for x in datasets :
refreshNow= driver.find_element_by_xpath('//button[starts-with(@aria-describedby, x) and @title="Refresh now"]')
refreshNow.click()
time.sleep(8)
我想选择并单击一个属性值为通过regex match传递的节点
一种方法是使用
format()
:除了format函数之外,还可以使用简单的字符串连接
相关问题 更多 >
编程相关推荐