Jump to content

microsoft store auto login (or auto fill)


demon964
 Share

Recommended Posts

You can use the Webdriver UDF.

WebDriver UDF - Help & Support (III)

For the attached example, please download the Edge Webdriver.exe (32Bit) and put it in the Folder "edgedriver_win32"

 https://developer.microsoft.co…oft-edge/tools/webdriver/

#include "wd_helper.au3"
#include "wd_core.au3"

;Global $_WD_DRIVER
Local $sDesiredCapabilities

;$_WD_DEBUG = $_WD_Debug_Info ; None ; Info
$_WD_DEBUG = $_WD_DEBUG_None  ;set to $_WD_DEBUG_None before compiling.?

$url = "https://autoit.de/wcf/login/?url=https%3A%2F%2Fautoit.de%2F"

$user = "test"
$pass = "test"

SetupEdge()

_WD_Startup()

; Hide the WebDriver Console
;_WD_ConsoleVisible(True)
_WD_ConsoleVisible(False)

$sSession = _WD_CreateSession($sDesiredCapabilities)

_WD_Window($sSession, "Maximize", "{}")
_WD_Navigate($sSession, $url)
_WD_LoadWait($sSession, 1500)
Sleep(1000)

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='username']")
ConsoleWrite("+ @error = " & @error & @CRLF)
$sElement_user = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='username']")

If @error = $_WD_ERROR_Success Then
    _WD_ElementAction($sSession, $sElement_user, 'value',$user)
    Sleep(500)
EndIf

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']")
ConsoleWrite("+ @error = " & @error & @CRLF)
$sElement_pass = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']")

If @error = $_WD_ERROR_Success Then
    _WD_ElementAction($sSession, $sElement_pass, 'value',$pass)
    Sleep(500)
EndIf

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='loginForm']/form/section[1]/div/input[1]")

If @error = $_WD_ERROR_Success Then
    _WD_ElementAction($sSession, $sElement, 'click')
Sleep(500)
EndIf

_WD_Shutdown()
_WD_DeleteSession($sSession)

Exit



 Func SetupEdge()

    ;_WD_Option('Driver', 'msedgedriver.exe')
    _WD_Option('Driver', 'D:\Scripte\WebDriver\EdgeDriver\edgedriver_win32\msedgedriver.exe')
    _WD_Option('Port', 9515)
    ;_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"')
    _WD_Option('DriverParams', '--verbose')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _
    '"ms:edgeOptions": {"excludeSwitches": ["enable-automation"], ' & _
    '"useAutomationExtension": false, "args": ["start-maximized"]}}}}'

EndFunc

 

Greetings,

gmmg

Webdriver_Edge_Test.zip

Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...