I'm new to automation testing (I'm using TestNG framework and Java language) I'm having trouble in locating an element which is inside iframe.
WebElement iframeSwitch= driver.findElement(By.id("configFrame"));
driver.switchTo().frame(iframeSwitch); System.out.println("Switched");
driver.findElements(By.xpath("//input[@ng-change='ProcessUpdates(m);']")).clear();
driver.findElement(By.xpath("//input[@ng-change='ProcessUpdates(m);']")).sendKeys("Arsenal");
driver.findElement(By.id("SearchAll")).click(); Thread.sleep(15000);
driver.switchTo().defaultContent(); JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("javascript:window.scrollBy(0,300)");
The element which i need to perform action is in the iframe itself, so do i need to use the driver.switchTo().defaultContent();
I tried to find it using the XPath. When I provided the XPath in Selenium IDE, it found the element, but when I wrote the script in TestNG and gave the same Xpath, it returned an exception of unable to locate the element. I'm new to Java as well as to automation. So if someone can provide some hint, it will be great help!