I am attempting to automate the process of Oauth 2.0 with selenium. I managed to get the entire process to work ChromeWebdriver ( headless and non-headless mode).
I want to use the code with phantomJS, as well but I cannot get the last button to press the "Grant Access to Box".
I know the button is visible since this condition works:
element = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#consent_accept_button")));
I have tried various methods of clicking the button: actions javascript executor and element click/submit None of these seem to cause it to go to the next page.
Grant access to Box Granting access to Box...I was expecting the url from the driver to be http://127.0.0.1/api/code?state=csrftoken&code=somerandomstring but it returns the url for this page so I know it's not advancing.
Looks like it had to do with the redirect string going to a local host address not resolving. Can't have it go to an address that gives a connection refused exception. HtmlUnitDriver works better for this implementation.