node-google-oauth2
node-google-oauth2 copied to clipboard
The blue button
I am using clj-webdriver
for my consent window. Using that, I can do
(wait-until #(not (empty? (find-elements {:xpath "//button[@id='submit_approve_access' and not(@disabled)]"}))) (* 15000))
The xpath expression allows to define a condition which the css selectors do not offer, that is to select upon state of the element. Using a 15 second window in which the web page and consent screen must have loaded and disabled the blue button by script.
Lookup the JavaScript solution, as this is Clojure, but the functionality comes straight from webdriver/selenium and it demonstrates the how anyway, this might give a little closure ;) (last paragraph of your readme is about this)
Oh and one extra gotcha was that, with webdriver/selenium firefox driver, it starts inside my /tmp
and so it uses a anonymous user profile in firefox (temporary). As such, I needed to pass it the additional commands and data to fill in the gmail username/email and password first, before I could get to a consent window.
Next step: xvfb and true headless to work... ><
Hi @robjens, thanks for the hint. Good to know that it works with selenium. Feel free to send a pull request in case you port your code to JS ;)
I'll take a look sometime soon ^^
edit: it should be along these lines, no means or time to setup an environment and actually test it :P
driver.wait(function() {
driver.findElement(By.id('submit_approve_access')).isEnabled().then(function(element) {
element.click();
});
}, 15000);