Ich würde gern mein komplettes Tread zur Verfügung stellen.
Vom Anfänger für Anfänger!
Vielleicht hilft es ja dem einen oder anderen.
C
#include <MsgBoxConstants.au3>
#include "wd_core.au3"
#include "wd_helper.au3"
; Dos Console für Fehlerübermittlung
; $_WD_DEBUG = "" ; ==> Dos Fehlerconsole aus
$_WD_DEBUG_INFO ; ==> Dos Fehlerconsole an
Local $sDesiredCapabilities, $sSession
SetupGecko( )
_WD_Startup( )
Local $sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://google.de")
MsgBox(0,"","") ; hält Browser an
_WD_DeleteSession($sSession)
_WD_Shutdown()
Func SetupGecko()
_WD_Option("Driver", "C:\Users\xx2\Desktop\WebDr Fire\WebDriver Test\WebDriver-0.5.0.1\geckodriver.exe")
_WD_Option ( 'DriverParams' , '--log trace --marionette-port 2828' )
_WD_Option('Port', 4444)
; ==> neues Profil anlegen funtioniert
;$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}'
; ==> neues Profil anlegen funktioniert
;$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
; ==> Benutzerprofil einlesen funktioniert
$sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & GetBenutzerFFProfil() & '"],"log": {"level": "trace"}}}}}'
; MsgBox(0, "DesiredCapabilities", $sDesiredCapabilities) ;Kontrolle
; Funktion ==> GetBenutzerFFProfil() <== muss beim Benutzerprofil vorhanden sein.
EndFunc ;==>SetupGecko
; ==> Funktion GetBenutzerFFProfile() muss beim Benutzerprofil vorhanden sein. **************************
Func GetBenutzerFFProfil()
Local $sDefault, $sProfilePath = ''
Local $sProfilesPath = StringReplace(@AppDataDir, '\', '/') & "/Mozilla/Firefox/"
Local $sFilename = $sProfilesPath & "profiles.ini"
Local $aSections = IniReadSectionNames ($sFilename)
If Not @error Then
For $i = 1 To $aSections[0]
$sDefault = IniRead($sFilename, $aSections[$i], 'Default', '0')
If $sDefault = '1' Then
$sProfilePath = $sProfilesPath & IniRead($sFilename, $aSections[$i], "Path", "")
ExitLoop
EndIf
Next
EndIf
Return $sProfilePath
EndFunc
;*******************************************************************************************************
Alles anzeigen