0

In my web page

<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
                       Name Button
<span class="caret"/>
</button>
<ul class="dropdown-menu">
<input id="---" type="hidden" value="---"/>
<li>
<label class="Styledcheckbox">
<div class="Styledcheckbox">
Tranche A                                         
</label>
</li>
 .....

Manuallly when I click on the button "Name Button" a popup menu appears but When I use the method Click() of selenium the popup menu apperas then it will be closed and in this case i can't detect the text on the popup .

IWebElement element = null;
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
element = wait.Until(ExpectedConditions.ElementToBeClickable(locator));
element.Click();

How can i replace this code, and the popup menu stay opened until i select a value from the popup.

I have tried also:

 Actions builder = new Actions(driver);
 IWebElement element = null;
 WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
 element = wait.Until(ExpectedConditions.ElementToBeClickable(locator));
 builder.MoveToElement(element).Release();
user3446229
  • 95
  • 3
  • 3
  • 14
  • Is this issue occurred in all browser or any specific browser??? – Om Prakash Jun 03 '16 at 10:29
  • chrome, i did'nt try with other browser! – user3446229 Jun 03 '16 at 10:32
  • Please open your console on browser and try to click on button using JavaScript...If popupMenu appears and hold.. then us JS to automate here.. – Om Prakash Jun 03 '16 at 10:42
  • How can use JS to automate with selenium and C#??!! – user3446229 Jun 03 '16 at 10:58
  • You should follow this link http://stackoverflow.com/questions/6229769/execute-javascript-using-selenium-webdriver-in-c-sharp – Om Prakash Jun 03 '16 at 11:01
  • I have tried : ` IWebElement element = null; WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); element = wait.Until(ExpectedConditions.ElementToBeClickable(locator)); IJavaScriptExecutor executor = (IJavaScriptExecutor)driver; executor.ExecuteScript("arguments[0].click();", element);` But i faced the same problem. – user3446229 Jun 03 '16 at 11:20
  • yes! the popup menu appears then closes.! – user3446229 Jun 03 '16 at 11:23
  • Can you try once all your stuff to other browser??? – Om Prakash Jun 03 '16 at 11:24
  • Can you share your website url??? – Om Prakash Jun 03 '16 at 11:28
  • the website is not accessible from the outside. It's confidential application. The problem that i faced some problem with the other browsers! – user3446229 Jun 03 '16 at 11:30
  • Can you tell me manually your popup menu opens after clicking or on mouse over on button??? – Om Prakash Jun 03 '16 at 11:33
  • Execute this script once.. function triggerMouseEvent (node, eventType) { var clickEvent = document.createEvent ('MouseEvents'); clickEvent.initEvent (eventType, true, true); node.dispatchEvent (clickEvent); } triggerMouseEvent (arguments[0], "mouseover"); triggerMouseEvent (arguments[0], "mousedown"); triggerMouseEvent (arguments[0], "mouseup"); triggerMouseEvent (arguments[0], "click"); – Om Prakash Jun 03 '16 at 11:35
  • manually, the popup oppens when i click.And i'm trying your proposition i will tell u about the result. – user3446229 Jun 03 '16 at 11:47
  • The same problem!!! it's weird! It's my first time that i faced such a problem. – user3446229 Jun 03 '16 at 13:48
  • Check if the js executes something different when you click manually or in selenium. Try to debbug it – Striter Alfa Jun 03 '16 at 13:52
  • manually when i click a popup menu is oppened, and with selenium the popup menu oppens then closes! – user3446229 Jun 03 '16 at 14:16
  • When i try with mouse events(JS) Nothing happens. – user3446229 Jun 03 '16 at 14:17

0 Answers0