this is more like a modal boxx"purpose of BCA" text boxI have to send some data to purpose of BCA text box, which is inside of a frame so at first I tried to switch to frame then send data. PFB code :
String baseUrl = "http://sc-cm-cde-ui-develop-creditmate-sa-01.apps.colt-np.ocp.standardchartered.com";
driver.get(baseUrl);
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//*[@id='root']/section/header/div/ul/li[6]/a")));
driver.findElement(By.xpath("//*[text()='Purpose of BCA']")).click();
//WebElement frame= driver.findElement(By.xpath("/html/body/div[1]/section/main/div/div[3]/div/div[1]/main/div/div[2]/div[2]/div/div/div[1]/div[1]/div[3]/div[1]/iframe"));
WebElement frame= driver.findElement(By.xpath("//*[@id='tiny-react_33728279521589173965543_ifr']"));
driver.switchTo().frame(frame);
driver.findElement(By.xpath("//*[@id='tinymce']/p")).sendKeys("shaif");
And this is the console error :
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='tiny-react_33728279521589173965543_ifr']"} (Session info: chrome=80.0.3987.122) For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:05:20.749Z' System info: host: 'INNH4XW7Y2', ip: '10.130.155.254', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_74' Driver info: org.openqa.selenium.chrome.ChromeDriver