我正在尝试填写一个表格,其中包含每个订单号的下拉菜单。
<select name="order(889673519).box(1).shippingmethod" onclick="" onchange=""
id="order(889673519).box(1).shippingmethod"><option value=""
id="order(889673519).box(1).shippingmethod.blank"></option>
对于每个下拉菜单,名称css选择器中的数字都会更改,因此第一个为889673519,而第二个为
<select name="order(889711159).box(1).shippingmethod" onclick="" onchange=""
id="order(889711159).box(1).shippingmethod"><option value=""
id="order(889711159).box(1).shippingmethod.blank"></option>
我可以使用什么路径来选择多个具有不同名称的元素,因此可以选择它们来遍历它们。
使用contains
功能:
elements = driver.find_elements_by_xpath("//select[contains(@name, 'order') and contains(@name, 'shippingmethod')]")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句