Jump to content

alexmerfi

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by alexmerfi

  1. Yes, this is a simple implementation. But, for example, if you have a heavily loaded virtual machine and the fiefox tab will be created for a very long time, it will not always work sleep. Of course SLEEP can be done for 5 minutes but in some tasks some people can lose a lot of money.
  2. Yes, you're right, I have not yet found how to fix this inside this function. Perhaps, if the _WD_ExecuteScript will store errors in the global variable, and I will check it through While 1 if $GlobalVariableOfErrorExecuteScript='okay' then exitloop wend
  3. Why Wrong? if i change timeout 5000 to 0 If TimerDiff($TimerNewTab) > 0 Then Return SetError($_WD_ERROR_Success, 0, $sTabHandle) i return $HandleTab='' (nothing)
  4. If $HandleTab<>'' then MsgBox(0,"","Table IS EXIST, because it return value of handle")  _WD_Window($sSession, 'Switch', '{"handle":"' & $HandleTab & '"}') EndIf
  5. Firefox 61.0 64 bit, Hyperv Windows 10 x32 Autoit 3.3.14.2 #include "wd_core.au3" #include "wd_helper.au3" Global $sSession Global $sDesiredCapabilities $_WD_DEBUG = False SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) $HandleTab = _WD_NewTab($sSession, True) MsgBox(0, "", $HandleTab) _WD_DeleteSession($sSession) _WD_Shutdown() Exit Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' EndFunc ;==>SetupGecko
  6. the handle do not return from the new tab, because this tab does not have time to create Fixed _WD_NewTab Func _WD_NewTab($sSession, $lSwitch = True) Local Const $sFuncName = "_WD_NewTab" Local $sTabHandle = '' Local $TimerNewTab = 0 _WD_ExecuteScript($sSession, 'window.open()', '{}') $TimerNewTab = TimerInit() While 1 If TimerDiff($TimerNewTab) > 5000 Then Return SetError($_WD_ERROR_Success, 0, $sTabHandle) If @error = $_WD_ERROR_Success Then Local $aHandles = _WD_Window($sSession, 'handles', '') $sTabHandle = $aHandles[UBound($aHandles) - 1] If $lSwitch Then _WD_Window($sSession, 'Switch', '{"handle":"' & $sTabHandle & '"}') EndIf ExitLoop EndIf Sleep(10) WEnd Return SetError($_WD_ERROR_Success, 0, $sTabHandle) EndFunc ;==>_WD_NewTab Now, if the tab is not created within 5 seconds, it returns an SetError
×
×
  • Create New...