Hi Friends,
I am stuck in a situation and not able to insert value in a text box.
Below is the code for the same:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].setAttribute('value', arguments[1]);",element,value1);
where
- driver is WebDriver object
- element is WebElement object
- value1 is the text
same code is working for other web pages.
WebElement is as:
<input class="ng-dirty ng-valid ng-valid-required" type="text" pattern="job_title" required="" data-ng-model="jobTitle"></input>
and when I execute above code it didn't show me any thing in text field but change the tag as
<input class="ng-dirty ng-invalid ng-invalid-required" type="text" pattern="job_title" required="" data-ng-model="jobTitle" data-invalid="" value="Title"></input>
Please help me in resolving the same.
Thanks,