Hello
Need help, i am unable to upload the file by using inbuilt keyword ‘Upload File’
Hence i am using a custom keyword but still i am unable to upload the file. Getting below error;
“07-13-2018 06:06:44 PM - [FAILED] - Unable to click on object ‘Object Repository/BM/Proposals/Browse_Solution_Diagram’ (Root cause: org.openqa.selenium.WebDriverException: unknown error: Element … is not clickable at point (243, 356).
Other element would receive the click: ”
I am using following custom keyword for File Upload
-----------------------------------------------------------
@Keyword
def uploadFile (TestObject to, String filePath) {
WebUI.click(to)
StringSelection ss = new StringSelection(filePath);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.delay(1000) //NOTE THE DELAY (500, 1000, 1500 MIGHT WORK FOR YOU)
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.delay(1000) //NOTE THE DELAY (500, 1000, 1500 MIGHT WORK FOR YOU)
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
However when i use the below custom code to click on Browse button, the test case is showing Passed, but it does not open the File Upload Dialog box…
@Keyword
def clickUsingJS(TestObject to, int timeout){
WebDriver driver = DriverFactory.getWebDriver()
WebElement element = WebUiCommonHelper.findWebElement(to, timeout)
JavascriptExecutor executor = ((driver) as JavascriptExecutor)
executor.executeScript(‘arguments[0].click()’, element)
}
Please help as I have already spend 3 days in this, but still didn’t find the solution
Refer to the screenshot for xpath that i am using for Browse button