Unable to get the text of webelement in selenium web driver for bootstrap-dropdown using xpath


I want to access each bootstrap dropdown menus in SERVICES and then have to select one service and click on that
refer this website, https://mybmtc.karnataka.gov.in/english

I use this XPath

IList<IWebElement> menus = driver.FindElements(By.XPath(".//*[@id='navbar - default']/div/div[2]/ul/li[2]/a"));

This is the inspect element code:

–> –> –>Chartered Services


You need to hover on Service, use the below CSS :


then Select the link Chartered Services using link_text.

to hover :

Actions builder = new Actions(driver);
Actions hover = builder.MoveToElement(driver.FindElement(By.CssSelector("a[title='Services']

and then click :

driver.FindElement(By.LinkText("Chartered Services")).Click();  

Answered By – cruisepandey

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published