Not able to enter data in a field using Selenium with java/javascript

130
July 23, 2019, at 00:30 AM

I'm trying to enter data in a field whose display is block. Here is my code snapshot:

I've tried following codes:

1st using java------>

@FindBy(xpath="//input[@class='form-control ng-pristine ng-valid ng-touched']")
public WebElement errorNotifRcpntOrdrng;
CamWizCHOR.errorNotifRcpntOrdrng.sendKeys(CommonConstants.EmailId);

So, I got this error after running this code:

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@class='form-control ng-pristine ng-valid ng-touched']"}

2nd using javascript------->

String js = "arguments[0].style.display='block'"; 
((JavascriptExecutor) driver).executeScript(js, CamWizCHOR.errorNotifRcpntOrdrng);
JavascriptExecutor js1 = (JavascriptExecutor) driver;
js1.executeScript("arguments[0].click();", CamWizCHOR.errorNotifRcpntOrdrng);
((JavascriptExecutor) driver).executeScript("arguments[0].value='abc@test.com.au';", CamWizCHOR.errorNotifRcpntOrdrng);

After running this code, I got same error message as above:

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@class='form-control ng-pristine ng-valid ng-touched']"}

Please have a look and suggest how can I enter data in this field.

Thanks.

READ ALSO
Create array with reversed words from user string

Create array with reversed words from user string

I am creating a program in which a user enters a string of words (Ex: I love you), and the program returns an array of the words in the string spelled backwards (Ex: I evol ouy)However, I cannot get my code to properly compile, and tried debugging, but cannot...

86
How to extract jar name and file name in jar from URL in spring cloud?

How to extract jar name and file name in jar from URL in spring cloud?

Recently, I am playing around with Spring CloudAnd I want to extract the jar name and file name in the jar from a URL

108
How to fix “no communication between server and client”

How to fix “no communication between server and client”

This is code provided to me for a classI am trying trying to fix a connection problem between the client and server

93
This method must return a result of type Specification<Employee> in Java 8

This method must return a result of type Specification<Employee> in Java 8

How to return using if else using Lambda expression ?

148