I am trying to do Selenium with Java casestudy on the web site https://www.demoblaze.com/index.html,
Steps:
Issue:
As findElement is NOT working even with WebDriverWait on the Log In popup, I have tried JavaScriptExecutor which is working fine with Username and Password.
js.executeScript("document.getElementsByTagName('input')[4].value="+"'"+user+"'"); js.executeAsyncScript("document.getElementById('loginpassword').value="+"'"+pass+"'");
However when I tried on Log in button using getElementsByClassName, querySelector, it did not work. Please help.
FYIP: None of the below working for me.
JavascriptExecutor js;
js.executeAsyncScript("arguments[0].click();","document.evaluate('//button[text()='Log in']', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;");
js.executeScript("document.querySelector('button').onclick = 'logIn()'.click();");
js.executeScript("document.getElementsByClassName('btn btn-primary')[2].click()");