Something like this code:
public void SideMenuNavigateTo(string menuOption)
{
this.SideMenu.FindElement(By.XPath("//a[contains(text(),'" + menuOption "')]"));
}
This code doesn't work, but is there a way to do something similar?
I have found the solution to my problem. The syntax should be a bit different
this.Driver.FindElement(By.XPath(String.Format("//a[contains(text(), '{0}')]", menuOption)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.