Hello I have problem with javascript excecutor in Selenium
Browser: Edge IE mode;IE11.
Script don't finish working.
I run button where after click show window Windows10
I use method:
public void clickJS(WebElement webElement, String nameElement) throws InterruptedException
{
waitUntilElementToBeClickable(webElement);
System.out.println(" Akcja - kliknięcie JS w obiekt: '"+nameElement+"'");
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click()", webElement);
}
@FindBy(css = "input[id='form1:Postepowanie_Pisma_DodajCnt:fileUpload_plik']")
WebElement epwdButtonWybierzPlik;
System.out.println("Rozpoczeło się wykonywanie skryptu js");
test.autoAction.clickJS(test.pomEpwd.epwdButtonWybierzPlik(), "inputDodajPismo");
System.out.println("Zakończyło się wykonywanie skryptu js
Any Ideas ?
What do you mean "Script don't finish working"? Do you mean
executeScriptdoesn't work or the methods after it doesn't work? Is there any error message?I made tests with code below and it works well, you can refer to my code sample. You can try to add wait after
executeScript.