Skip to main content

i am using selenium webdriver latest version Selenium, cannot find button to click

iI got stuck to write the code in webdriverWebDriver.i I have the code below :

Select

<button class="btn" onclick="javascript:return PopulateInvestor('hdnInvestorId', 'txtInvestorName', 'txtInvestorEmail', '', '', '', '', '',false,'hdnInvestorName','hdnInvestorEmail');">Select</button>

forFor this iI wrote JavascriptExecutor jse = (JavascriptExecutor)driver;the following:

JavascriptExecutor jse = (JavascriptExecutor)driver;         
jse.executeScript("document.getElement(By.xpath(\"//div[@class='modal-footer']/button[@onclick'return javascript:return PopulateInvestor('hdnInvestorId', 'txtInvestorName', 'txtInvestorEmail', '', '', '', '', '',false,'hdnInvestorName','hdnInvestorEmail');']\").click()");
    

But still it could not identify element and could not click the button. I can see there is select button present at the end of the code but dontdon't know how to use it  .Please Please advise for this.

i got stuck to write the code in webdriver.i have the code below :

Select

for this i wrote JavascriptExecutor jse = (JavascriptExecutor)driver;

    jse.executeScript("document.getElement(By.xpath(\"//div[@class='modal-footer']/button[@onclick'return javascript:return PopulateInvestor('hdnInvestorId', 'txtInvestorName', 'txtInvestorEmail', '', '', '', '', '',false,'hdnInvestorName','hdnInvestorEmail');']\").click()");
    

But still it could not identify element and could not click the button. I can see there is select button present at the end of the code but dont know how to use it  .Please advise for this.

I got stuck to write the code in WebDriver. I have the code below :

<button class="btn" onclick="javascript:return PopulateInvestor('hdnInvestorId', 'txtInvestorName', 'txtInvestorEmail', '', '', '', '', '',false,'hdnInvestorName','hdnInvestorEmail');">Select</button>

For this I wrote the following:

JavascriptExecutor jse = (JavascriptExecutor)driver;         
jse.executeScript("document.getElement(By.xpath(\"//div[@class='modal-footer']/button[@onclick'return javascript:return PopulateInvestor('hdnInvestorId', 'txtInvestorName', 'txtInvestorEmail', '', '', '', '', '',false,'hdnInvestorName','hdnInvestorEmail');']\").click()");
    

But still it could not identify element and could not click the button. I can see there is select button present at the end of the code but don't know how to use it. Please advise for this.

Source Link
Ranjan Gupta
  • 383
  • 5
  • 6
  • 20

i am using selenium webdriver latest version

i got stuck to write the code in webdriver.i have the code below :

Select

for this i wrote JavascriptExecutor jse = (JavascriptExecutor)driver;

    jse.executeScript("document.getElement(By.xpath(\"//div[@class='modal-footer']/button[@onclick'return javascript:return PopulateInvestor('hdnInvestorId', 'txtInvestorName', 'txtInvestorEmail', '', '', '', '', '',false,'hdnInvestorName','hdnInvestorEmail');']\").click()");
    

But still it could not identify element and could not click the button. I can see there is select button present at the end of the code but dont know how to use it .Please advise for this.