Selenium visit event does not trigger a corner click

I have this page where there is a text field, and there is a save button associated with each text field. I need to click on the save button to save the value in the text box. He works manually and uses selenium. But when launched through Selenium WebDriver, this does not save the value of the text field. But an error exception is not thrown. Login, click works. savetextvalue () does not start short. Similar problem. Selenium visit event does not trigger angularjs event

<pp-save-control fn-save-text="saveText();" btn-class="btn btn-default btn-mtl" button-id="btnkbaemailauthsub" place-holder-text="" input-class="tb-mtl" input-id="txtkbaemailauthsub" config-name="40" title-text="KBA email authentication subject" outer-container-class="div-mtl-header" class="ng-isolate-scope"><div class="div-mtl-header"> <span class="label-mtl ng-binding">KBA email authentication subject</span><img ng-hide="(isHelpHidden != null &amp;&amp; isHelpHidden != 'true') ? false : true" class="help-mtl ng-hide" src="/Images/help.png"> <div class="div-mtl-tb-holder"> <input type="text" placeholder="" class="tb-mtl" name="txtkbaemailauthsub" id="txtkbaemailauthsub"> <button ng-click="saveTextValue();" ng-hide="false" class="btn btn-default btn-mtl btn-mtl-alignment" name="btnkbaemailauthsub" id="btnkbaemailauthsub" type="button">save</button> </div> </div> </pp-save-control> 

There are several text fields and an associated save button. Depending on the value of "config-value" (you can see at the top), the value is saved.

+7
angularjs selenium selenium-webdriver selenium-ide
source share
4 answers

Replace the locator to suit your convenience.

 WebElement element= driver.findElement(By.id("btnkbaemailauthsub")); JavascriptExecutor executor = (JavascriptExecutor) driver; executor.executeScript("arguments[0].click();", element); 

OR

 JavascriptLibrary jsLib = new JavascriptLibrary(); jsLib.callEmbeddedSelenium(driver,"triggerMouseEventAt", element,"click", "0,0"); 

OR

 WebElement element= driver.findElement(By.id("btnkbaemailauthsub")); // Configure the Action Actions action = new Actions(driver); //Focus to element action.moveToElement(element).perform(); // To click on the element action.moveToElement(element).click().perform(); 

Hope this helps you :)

Come back to me if there is still a problem :)

+5
source share

In Selenium IDE try:

  <td>sendKeysAndWait</td> <td>id=mybutton</td> <td>${KEY_ENTER}</td> 

same with Webdriver:

 WebElement element_p = (new WebDriverWait(_driver, 3)) .until(ExpectedConditions.visibilityOfElementLocated(By .id("myButton"))); element_p.sendKeys(Keys.RETURN); 
+2
source share

Try entering wait between your actions because Selenium does not know how angular loads and works. The protractor was created correctly to handle web pages angular, which is a wrapper on top of selenium webdriver. However, if you still want to test angularjs with Selenium , then wait a few seconds implicitly or the free time between each action should help you in your needs and fulfill what you intend. Hope this helps.

+1
source share
 driver = webdriver.Chrome('/path to /webdriver 22'); driver.find_element_by_css_selector('button[ng-click="func()"]'); 
+1
source share

All Articles