public static XPath ( string xpathToFind ) : |
||
xpathToFind | string | The XPath query to use. |
Результат |
public void BookIntervalFromNotBooked(string courtNumber) { var startTimeHour = Convert.ToInt32(DateTime.Now.ToString("HH")); startTimeHour = startTimeHour + 1; var startTimeMinutes = DateTime.Now.ToString("mm"); var startTimeSeconds = DateTime.Now.ToString("ss"); Console.WriteLine(startTimeHour + ":" + startTimeMinutes + ":" + startTimeSeconds); switch (courtNumber) { case "Court1": driver.FindElement(By.XPath( "//*[@id='book-by-date-view']/div/div[2]/div[2]/ul/li[1]/div/div/div[2]/div/div[" + startTimeHour + "]")).Click(); break; case "Court2": driver.FindElement(By.XPath( "//*[@id='book-by-date-view']/div/div[2]/div[2]/ul/li[2]/div/div/div[2]/div/div[" + startTimeHour + "]")).Click(); break; case "Court3": driver.FindElement(By.XPath( "//*[@id='book-by-date-view']/div/div[2]/div[2]/ul/li[3]/div/div/div[2]/div/div[" + startTimeHour + "]")).Click(); break; } }
/// <summary> /// Gets a mechanism to find elements by an XPath query. When searching within a <see cref="IWebElement"/> /// using xpath be aware that <see cref="IWebDriver"/> follows standard conventions: a search prefixed with /// <c>"//"</c> will search the entire document, not just the children of this current node. Use <c>".//"</c> /// to limit your search to the children of this <see cref="IWebElement"/>. /// </summary> /// <param name="xpathToFind">The XPath query to use.</param> /// <returns>A <see cref="OpenQA.Selenium.By"/> object the driver can use to find the elements.</returns> public static new SeleniumBy XPath(string xpathToFind) => SeleniumBy.XPath(xpathToFind);
public void WhenIScrollDownPageAndClickOnTennis() { driver.FindElement(By.XPath("//*[@id=\"page\"]/div[2]/div[2]/div/div/div/div/div[16]/nav/ul/li[3]/a")).Click(); }