-6
我正在使用selenium web驱动程序和firefox驱动程序。我必须检查这个元素是否在使用XPath的页面中,这样我才能继续下一步,但我不知道该怎么做。检查XPath是否存在元素
//*[@id='view_container']/form/div[2]/div/div/div/ul/li[1]/div/div[2]
if (idk what i have to write here)
{
driver.FindElement(By.XPath("//[@id='view_container']/form/div[2]/div/div/div/ul/li[1]/div/div[2]"));
// if we found xpath
}
else
{
// if don't find xpath
}
评论不延长讨论或调试会话;这个对话已经[转移到聊天](http://chat.stackoverflow.com/rooms/152940/discussion-on-answer-by-kapil-i-need-about-if-c-if-there-is-一个-的xpath - 或不是)。如果您仍然遇到问题,请更新问题。 –