Getting following error when clicking.

Scenario: In application I have collapsed button on expanding that , its submenu are listed and clicking on sumenu open that particular page.

org.openqa.selenium.WebDriverException: d is undefined
Command duration or timeout: 10.07 seconds
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_23'
Session ID: 59cdfb73-3810-4de5-ae57-4410176c344d
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=17.0.1, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
 at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
 at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
 at com.ptgi.dhpbx.core.BasePage.click(BasePage.java:79)

I am able to click on collapsed button but not able to click on submenu using any of ID, xpath, css locator. But using javascript I am able to click.

Next step: There are checkbox in the page and throws same error when running the script. While recording with IDE two lines are recorded for checking the chekbox.

click "//input[@id='input-5']"

click //section[@id='main']/article/div[2]/div/div/div/ins

Dom is :

<section id="main" data-bind="router: { transition:'entrance' }">

<article data-view="views/voicemail/voicemailSettings" style="" data-active-view="true">
<p data-i18n="pbx:voicemailSettings.subtitle">Specify which calls are sent to voicemail, send voicemail recordings to your email, change your voicemail passcode and set voicemail greetings.</p>
<div class="emptyBlock20"/>
<div class="contentContainer">
<div class="form-element indentRight">
<div class="icheckbox-radio">
<div class="icheckbox_square-blue focus hover">
<input id="input-5" type="checkbox" data-bind="CustomCheckBox: {checked: allCallsToVm}, click: function() { busyCallsToVm(allCallsToVm()); noAnsCallsToVm(allCallsToVm()); } " name="forwardCallRadio" tabindex="5" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: none repeat scroll 0% 0% rgb(255, 255, 255); border: 0px none; opacity: 0;"/>
<ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: none repeat scroll 0% 0% rgb(255, 255, 255); border: 0px none; opacity: 0;"/>

<label class="" data-i18n="pbx:voicemailSettings.sendAllCallsToVM" for="input-5">Send all calls to voicemail</label>

Please help

Thanks, Rakesh

  • Can you post the code too? – FDM May 29 '15 at 9:45
  • The code is public void executexpath(String s)throws Exception{ WebElement element = driver.findElement(By.xpath(s)); JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].click();", element); } // click on sumenu under collapsed menu executeJS("div.sub-nav-content.green"); //Then on page click on check box and click on save click("//input[@id='input-5']"); click("(//a[text()='Save'])[1]"); – Rakesh May 29 '15 at 11:41
  • @FDM If I am using javascript to click on the checkbox too, i am able to . So without using javascript it is throwing this error for any control. – Rakesh May 29 '15 at 12:12
  • 1
    your error says d is undefined - show the code where d is called please – FDM May 29 '15 at 12:49
  • 1
    What code is at BasePage.java:79 – Ardesco Sep 10 '15 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.