[英]How do I refer to an attribute that contains a colon? (Selenium/python/xpath/css)
Every field has the same property apart from the wire: model attribute, but I can't link to it as I don't have enough experience to write the correct selector.除了电线之外,每个字段都有相同的属性:model 属性,但我无法链接到它,因为我没有足够的经验来编写正确的选择器。 I would be very grateful if you can help me put together the correct selection.
如果您能帮助我做出正确的选择,我将不胜感激。
Here's a CSS Selector that should work to grab the 'lastName' element, for example:这是一个 CSS 选择器,它应该可以抓取“lastName”元素,例如:
'input[wire:model="lastName"]'
Here's some hopefully helpful documentation on writing selectors.这里有一些关于编写选择器的有用文档。
.grid > div:first-child input {
/* this would target Last Name */
}
.grid > div:nth-child(3) input {
/* replace 3 with whatever you want. 1 would target Last Name, 2 would target First Name, 3 would target Middle Name
}
See if this works:-看看这是否有效: -
textValues = driver.find_elements_by_xpath(".//div[@class='space-y-2']/input")
for e in textValues:
print(e.get_attribute("wire:model"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.