Thank you very much for following up @whimboo. I unfortunately cannot provide as much detail as I would like, since
- I only have this one instance of the problem
- which arises while trying to automate 2-factor authentication through Duo Security (nothing nefarious; my company is mandating this, and I am trying to automate these hoops I have to jump through…).
I can show a fragment of the DOM I see in the Duo iframe, in a pastebin (not all of it; parts of the DOM display my home IP, other parts reference what seem to be semi-permanent ID numbers used internally by Duo, etc., so some lines are marked REDACTED
).
The button in question is “the one” with id="passcode"
, but you’ll see it appears twice, hence the scare quotes here. I am not well-versed enough in the subtleties of how a DOM might be put together, but I thought the id was supposed to be unique.
In any event, the behavior I am seeing is as follows (with the code referencing a perl implementation of the driver bindings; this is what I happen to be using at the moment):
- if I run js all is well, and I can click the button (or presumably its first instance): I can simply pass the string
btn=document.getElementById("passcode");
btn.click();
for webdriver
to run as a script for me, with $driver->script(<that-whole-thing-as-a-string>)
;
-
if I search for all elements with id="passcode"
directly with webdriver
(in its perl
incarnation this means my @btns=$driver->find_id("passcode")
), then I can
- click the first element found in that array with
$btns[0]->click()
to absolutely no effect,
- or click the second one with
$btns[1]->click()
to receive a complaint:
element not interactable: Element <button id="passcode" class="positive auth-button" type="submit"> could not be scrolled into view