When using XPath to end fuzzy matching, the following problems are encountered: // Input [ends with (@ ID, ‘W’)] cannot locate the element whose ID ends with W in the input tag. The error is as follows
SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string ‘//input[ends-with(@id,’w’)]’ is not a valid XPath expression.
(Session info: chrome=94.0.4606.81)
After querying relevant data, it is found that the reason for the problem is: the ends with method is the syntax of XPath 2.0, while the browser only supports XPath 1.0, so the above problem occurs.
terms of settlement:
According to the great God, it can be replaced by the following method equivalent to ends with:
//input[substring(@id, string-length(@id) – string-length(‘w’) +1) = ‘w’]
The reference is as follows, and its link is: https://stackoverflow.com/questions/36053559/how-to-locate-dynamic-element-using-xpathends-with-function-not-working
Similar Posts:
- When hive processes data, it cannot run directly and reports an error: execution error, return code 2 from org.apache.hadoop.hive.ql.exec.mr
- Mixed Content: The page at was loaded over HTTPS, but requested an insecure image.
- event.srcElement And event.target The difference between
- Python skills — XPath helper in Chrome browser
- The XPath tool plug-in for Firefox browser (not supported by advanced versions of Firefox)
- Selenium Error: ElementNotInteractableException: Message: element not interactable
- Access to XMLHttpRequest at ‘http://localhost:9990/’ from origin ‘http://IP:Port’ has been blocked by CORS policy…more-private address space `local`
- 【complier/asm】impossible constraint in ‘asm’ error
- This content should also be served over HTTPS
- [Solved] Vue3 vetur error: has no default export component is not exported