Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/25/2022 in all areas

  1. Uploaded a new Zip file that contains some tweaks to avoid checking comments. Thanks
    1 point
  2. try this: #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <MsgBoxConstants.au3> #include <String.au3> #include <Array.au3> #include "wd_core.au3" #include "wd_helper.au3" Global $sSession _Main() Func _Main() _WD_UpdateDriver("chrome") ; Initialisierung ChromeDriver Local $sDesiredCapabilities = _SetupChrome() ; Launch the designated web driver console app _WD_Startup() ; Request new session from web driver $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Window($sSession, 'MAXIMIZE') _Example() If @error Then ConsoleWrite("! ---> @error=" & @error & " @extended=" & @extended & _ " : some error occured" & @CRLF) ; Session schließen _WD_DeleteSession($sSession) ; ChromeDriver beenden _WD_Shutdown() EndFunc ;==>_Main Func _Example() Local Const $sUrl = 'https://www.bibleserver.com/ELB/1.Mose1' Local $aElements ; Navigate to the designated URL _WD_Navigate($sSession, $sUrl) ;~ fixing here Local $coockies = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@class='cc-primary-btn']", Default, Default, BitOR($_WD_OPTION_Enabled, $_WD_OPTION_Visible)) _WD_ElementActionEx($sSession, $coockies, "CLICK") ; Wait for a browser page load to complete before returning _WD_Loadwait($sSession) ;~ fixing here _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='print-footer hidden-screen-only']", Default, Default) #Region - called issue - fixed $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='print-footer hidden-screen-only']", Default, True) If @error Then Return SetError(@error, @extended, 0) Local $sText = '', $aOptions If IsArray($aElements) Then For $mi = 0 To UBound($aElements) - 1 $sText = _WD_ElementAction($sSession, $aElements[$mi], 'property', 'innerText') If @error Then ExitLoop MsgBox(0, $mi & '/' & UBound($aElements), $sText, 5) $aOptions = StringSplit($sText, @LF, $STR_NOCOUNT) $aElements[$mi] = $aOptions[0] Next _ArrayDisplay($aElements) Else MsgBox(0, '', 'nothing found') EndIf #EndRegion - called issue - fixed #Region - mLipok solution $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='print-footer hidden-screen-only']", Default, True) If @error Then Return SetError(@error, @extended, 0) Local $sJavaScript = _ "var element = arguments[0];" & _ "return element.innerText;" If IsArray($aElements) Then For $mi = 0 To UBound($aElements) - 1 $sText = _WD_ExecuteScript($sSession, $sJavaScript, __WD_JsonElement($aElements[$mi]), Default, $_WD_JSON_Value) If @error Then ExitLoop MsgBox(0, $mi & '/' & UBound($aElements), $sText, 5) $aOptions = StringSplit($sText, @LF, $STR_NOCOUNT) $aElements[$mi] = $aOptions[0] Next EndIf #EndRegion - mLipok solution EndFunc ;==>_Example Func _SetupChrome() $_WD_DEBUG = False ; Webdriver Debug-Fenster _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9715) _WD_Option('DriverParams', ' --port=9715 --log-path="' & @ScriptDir & '\chrome.log"') Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' Return $sDesiredCapabilities EndFunc ;==>_SetupChrome
    1 point
×
×
  • Create New...