I tried uploading a photo in Indyarocks.com and got an error
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with.
I inserted
((JavascriptExecutor) driver).executeScript("arguments[0].click();", X);
since i got ElementNotVisibleException
and was not able to click on the upload photo box in the frame.Worked fine after the insertion.
Displayed a windows pop up to choose file from system and i am not able to choose the file with my code as below:
My code looks like this:
driver.findElement(By.xpath("//input[@id='pic_up_click']")).click();
frames= driver.findElements(By.tagName("iframe"));
System.out.println(frames.size());
Thread.sleep(5000L);
WebElement X = driver.findElement(By.xpath("//*[@id='uploadfeedpic' or @type='file' or @name='uploadfile']"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", X);
Thread.sleep(5000L);
X.sendKeys("C:\\pics\\kesar\\24082011323.jpg");