Website if you want to try by your self: https://phptravels.com/ to run the script

<div class="lvl-0 dropdown">
  <div class="dropdown-content featuresDropdown">
    <a class="lvl-1 link nav-link" href="https://phptravels.com/features">Main Features</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/hotels-module-features/">Hotels Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/flights-module-features/">Flights Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/tours-module-features/">Tours Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/cars-module-features/">Cars Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/offers-module-features/">Offers Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/blog-module-features/">Blog Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/newsletter-module-features/">Newsletter Module</a>
    <a class="lvl-1 link nav-link" href="https://phptravels.com/cms-module-features/">CMS Module</a>

public void featureButton()
    Actions builder = new Actions(webDriver);
    IWebElement dropdown = webDriver.FindElement(POM.mainfeature);
    IWebElement option = webDriver.FindElement(POM.Option);
    Actions hoverClick = builder.MoveToElement(dropdown).Click(option).Click();


public void WaitTime()
    WebDriverWait webDriverWait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(100));

public static class POM

    public static By mainfeature = By.XPath("//*[@class=\"lvl-0 dropdown\"]");
    public static By Option = By.XPath("//*[contains(text(),'Main Features')]");

    OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:54020/session/a4d224f68515fa2eba6289d48ae17d71/url timed out after 60 seconds.
      ----> System.Net.WebException : The request was aborted: The operation has timed out.
  Stack Trace: 
    HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
    HttpCommandExecutor.Execute(Command commandToExecute)
    DriverServiceCommandExecutor.Execute(Command commandToExecute)
    RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
    RemoteWebDriver.set_Url(String value)
    RemoteNavigator.GoToUrl(String url)
    LogInTest.Test() line 29
    HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)]

enter image description here

  • 1
    Thank you for adding the screenshot. Could you please also add the code you have tried, and the full error message you receive?
    – Kate Paulk
    Commented Feb 3, 2021 at 12:27
  • I added everything, waiting for your kind response
    – Khan
    Commented Feb 4, 2021 at 3:27
  • Which line of your code is giving the error?
    – Kate Paulk
    Commented Feb 5, 2021 at 12:37

2 Answers 2


You should be able to find the web element by its link text of "Main Features".

driver.FindElement(By.LinkText("Main Features"));
  • thanks for your efforts and giving me time, I added everything... you can check it. It's still show me the error
    – Khan
    Commented Feb 4, 2021 at 3:29

its hard to understand without screen shot and which one of the element is a dropdown button and what are the option.

if its a dropdown that gets displayed on click then use:

WebDriver.FindElement( By.Xpath( "//*[@class=\"lvl-0 dropdown\"]")).click();      
WebDriver.FindElement(By.LinkText("Main Features")).click(); 

If its a dropdown that works with hover then use :

Actions builder = new Actions( WebDriver );
IWebElement dropdown=  WebDriver.FindElement( By.Xpath( "//*[@class=\"lvl-0 dropdown\"]"));   
IWebElement option= WebDriver.FindElement(By.LinkText("Main Features"));   
Actions hoverClick = builder.MoveToElement(dropdown).click(option).Click();
  • Message: OpenQA.Selenium.NoSuchElementException : no such element: Unable to locate element: {"method":"link text","selector":"Main Features"} Display me this error
    – Khan
    Commented Feb 3, 2021 at 9:29
  • @Khan try //*[contains(text(),"Main Features")]
    – PDHide
    Commented Feb 3, 2021 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.