Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#FindElement-Xpath中的管道字符_C#_Selenium_Selenium Webdriver_Xpath - Fatal编程技术网

C#FindElement-Xpath中的管道字符

C#FindElement-Xpath中的管道字符,c#,selenium,selenium-webdriver,xpath,C#,Selenium,Selenium Webdriver,Xpath,硒C#找不到元素 driver.FindElement(By.XPath(@".//*[@id='nnnn_record|OneToMany|SubGridAssociated|Mscrm.SubGrid.ndis_record.AddNewStandard']/span")).Click(); 已尝试\\\\\124;逃逸,但仍未找到 driver.FindElement(By.XPath(@".//*[@id='nnnn_record\\|OneToMany\\|SubGridAssoci

硒C#找不到元素

driver.FindElement(By.XPath(@".//*[@id='nnnn_record|OneToMany|SubGridAssociated|Mscrm.SubGrid.ndis_record.AddNewStandard']/span")).Click();
已尝试
\\\\\124;
逃逸,但仍未找到

driver.FindElement(By.XPath(@".//*[@id='nnnn_record\\|OneToMany\\|SubGridAssociated\\|Mscrm.SubGrid.ndis_record.AddNewStandard']/span")).Click();

'\|' is not allowed in Visual Studio

不需要转义
|
字符。您是否正在尝试查找id值为
nnnn|u record | OneToMany | SubGrid associated | Mscrm.SubGrid.ndis|u record.AddNewStandard
的元素?是的,第一个驱动程序行,但在执行时找不到。我强烈怀疑它找不到任何与管道字符无关的原因。当然,我可能错了,但这取决于你通过提供一个可复制的例子来提供证据。