Reputation: 11
I try to click a link on a wlan captive portal with a powershell script. The issue is, the method can't be found and i get the following error.
Method invocation failed because [System.__ComObject] does not contain a method named 'click'.
The relevant section of my script:
$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible = $true
$ie.Navigate($url)
Do {
Start-Sleep -Seconds 3
} while ($ie.Busy)
$button = $ie.document.getElementsByClassName('dtag-button btn btn-dark btn-block center-block btn-start')
$button.Click()
I also tried the Submit() method, but get also the same error. Method invocation failed because [System.__ComObject] does not contain a method named 'Submit'.
The source code of the website respectively the relevant section:
<div class="button-wrapper module-content">
<a class="dtag-button btn btn-dark btn-block center-block btn-start" role="button" href="https://www.hotspot.de/" target="_blank" transloco="welcome.button.startSurfing">Start surfing</a>
<!----></div>
Many thanks in advance!
Upvotes: 0
Views: 107
Reputation: 11
The solution for the problem
$button = $ie.document.getElementsByClassName('dtag-button btn btn-dark btn-block center-block btn-start') | where-object {$_.role -eq 'button'}
Many thanks to Dai for the hint!
Upvotes: 1