在cssSelector Webdriver上转义特殊字符 [英] Escaping Special Characters on cssSelector webdriver
本文介绍了在cssSelector Webdriver上转义特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何转义以下特殊字符,以便可以使用div上的ID来获取表格?这是我的cssSelector:
how can I escape the following special character so i can use the ID on the div to get the form? This is my cssSelector:
#form > div:nth-child(4)>div:nth-child(2) > div:nth-of-type(2) > div:nth-of-type(2)
这是html代码:
div id="form:panelGridTransactionInfo" class="ui-panel ui-widget ui-widget-content ui-corner-all"
谢谢
推荐答案
您可以使用反斜杠将其转义,如下所示:
You escape it with a backslash like so:
#form\:panelGridTransactionInfo > div:nth-child(4) > div:nth-child(2) > div:nth-of-type(2) > div:nth-of-type(2)
在Java中,重复反斜杠以在字符串内进行自身转义:
In Java, repeat the backslash to escape itself within the string:
"#form\\:panelGridTransactionInfo > div:nth-child(4) > div:nth-child(2) > div:nth-of-type(2) > div:nth-of-type(2)"
这篇关于在cssSelector Webdriver上转义特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文