elexy 发表于 2020-12-27 07:18:22

【已解决】替代IE.au3的谷歌浏览器UDF

本帖最后由 elexy 于 2020-12-27 10:43 编辑

原来系统内置的 IE.au3   _IEBodyReadText()用在IE没问题 ,现在很多都得用chrome才能正常访问的网站, 国外官网找到的UDF,看了一下,好像没有能替代 _IEBodyReadText()的, 老师们有何见解吗?

- _WD_NewTab($sSession, $lSwitch = True, $iTimeout = -1, $sURL = "", $sFeatures = "")
- _WD_Attach($sSession, $sString, $sMode = 'title')
- _WD_LinkClickByText($sSession, $sText, $lPartial = True)
- _WD_WaitElement($sSession, $sStrategy, $sSelector[, $iDelay = Default[, $iTimeout = Default[, $lVisible = Default[, $lEnabled = Default]]]])
- _WD_GetMouseElement($sSession)
- _WD_GetElementFromPoint($sSession, $iX, $iY)
- _WD_LastHTTPResult()
- _WD_GetFrameCount()
- _WD_IsWindowTop()
- _WD_FrameEnter($sIndexOrID)
- _WD_FrameLeave()
- _WD_HighlightElement($sSession, $sElement[, $iMethod = 1])
- _WD_HighlightElements($sSession, $aElements[, $iMethod = 1])
- _WD_jQuerify($sSession[, $sjQueryFile = Default[, $iTimeout = Default]])
- _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector, $sStartElement = "")
- _WD_ElementSelectAction($sSession, $sSelectElement, $sCommand)
- _WD_ConsoleVisible($lVisible = False)
- _WD_LoadWait($sSession[, $iDelay = 0[, $iTimeout = -1[, $sElement = '']]])
- _WD_Screenshot($sSession, $sElement = '', $nOutputType = 1)
- _WD_SelectFiles($sSession, $sStrategy, $sSelector, $sFilename)
- _WD_GetShadowRoot($sSession, $sStrategy, $sSelector, $sStartElement = "")
- _WD_IsLatestRelease()
- _WD_UpdateDriver($sBrowser[, $sInstallDir = Default[, $lFlag64 = Default[, $lForce = Default]]])
- _WD_DownloadFile($sURL, $sDest[, $iOptions = Default])
- _WD_SetTimeouts($sSession[, $iPageLoad = Default[, $iScript = Default[, $iImplicitWait = Default]]])
- _WD_GetElementById($sSession, $sID)
- _WD_GetElementByName($sSession, $sName)
- _WD_SetElementValue($sSession, $sElement, $sValue)
- _WD_ElementActionEx($sSession, $sElement, $sCommand[, $iXOffset = Default[, $iYOffset = Default[, $iButton = Default[, $iHoldDelay = Default]]]])
- _WD_ExecuteCdpCommand($sSession, $sCommand, $oParams)
- _WD_GetTable($sSession, $sBaseElement)


chamlien 发表于 2020-12-27 10:07:28

本帖最后由 chamlien 于 2020-12-27 10:11 编辑

UDF里面有句核心代码,用于获取响应状态,基本上作者都是通过执行js代码来操作dom$sResponse = _WD_ExecuteScript($sSession, 'return document.readyState', '')因此获取HTML可以这样:
$sHtml = _WD_ExecuteScript($sSession, 'document.getElementsByTagName('html').innerHTML', '')获取整个HTML的文本:
$sHtmlText = _WD_ExecuteScript($sSession, 'document.getElementsByTagName('html').innerText', '')获取整个Body里的文本:
$sBody = _WD_ExecuteScript($sSession, 'document.getElementsByTagName('body').innerText', '')作者也抽取了执行js的方法:_WD_jQuerify,楼主可以研究研究

elexy 发表于 2020-12-27 10:37:28

二楼的老师真的历害。。。佩服,谢谢!
页: [1]
查看完整版本: 【已解决】替代IE.au3的谷歌浏览器UDF