I want to perform XSS by entering something like <script> alert (Testing)</script>
into text fields. On my page, I have a combination of different types of form fields. The condition I need is, if it is a text field then that input should be set with my text or else just skip that web element.
I'm getting Exception in thread "main" org.openqa.selenium.ElementNotInteractableException
: element not interactable error after it reaches a dropdown field.
Can anyone help me? Thanks in advance
List<WebElement> webElements= driver.findElements(By.xpath("//*"));
List<WebElement> txtfields = driver.findElements(By.xpath("//input[@type='text' or @type='password']"));
for(int i=0;i<webElements.size();i++){
for(int j=0;j<txtfields.size();j++){
if(webElements.contains(txtfields.get(i))){
txtfields.get(j).sendKeys("testing data " + (j + 1));
Thread.sleep(3000);
}
else{
continue;
}
}
Thread.sleep(5000);
}