MoveToElement and Click () in selenium webdriver don't work for me in C #

I have a toggle button that only becomes active / visible when MoseOver is on it. I need to click on it and select options from the dropdown menu. This is the code and my attempts to automate below:

<div class="project active">
<div class="header">
  <span class="badge badge-info">0 sites</span>
     <a class="description" data-original-title="auto test" rel="tooltip" href="#">
  <div class="modified">Modified: 2013-01-30 18:46:08Z</div>
  <div class="btn-group">
     <a class="btn btn-mini dropdown-toggle" href="#" data-target="#projectConfigMenu_62">
       <i class="icon-cog"></i>
       <span class="caret"></span>
     </a>
  <ul id="projectConfigMenu_62" class="dropdown-menu" style="top: 297.867px; left: 194px; display: none;">
</div>

      

This is how I am trying to solve it, I can see the button but would not click on it:

IWebElement active_element = driver.FindElement(By.XPath(".//div[@class='project active']"));            
IWebElement button = active_element.FindElement(By.XPath("//a[@class='btn btn-mini dropdown-toggle']"));             
IWebElement buttondrop = button.FindElement(By.XPath("//i[@class='icon-cog']"));
Actions builder = new Actions(driver);             
builder.MoveToElement(active_element).MoveToElement(buttondrop).Click().Build().Perform();

      

+3


source to share





All Articles