Jump to content

Recommended Posts

Posted

Hello,

I am currently using the _IEDocReadHTML for checking the HTML code for my websites using IE browser. Please let me know what will be the UDF for the _IEDocReadHTML in WebDriver UDF using edge as browser. . Can we use _WD_Attach($sSession, $sString, $sMode = HTML) for checking the HTML code of the website for edge browser using WD function.

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


Local $URL = "https://www.autoitscript.com/site/"

$_WD_DEBUG = $_WD_DEBUG_None ; Could also use $_WD_DEBUG_Error
Local $sDesiredCapabilities, $sSession, $sElement

SetupEdge()
_WD_Startup()
Sleep(2000)
;_WD_ConsoleVisible()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession,$URL)
Sleep(4000)

$sString = "<a href="/site/autoit/">AutoIt</a>"
$sMode = "HTML"
$PageSource=_WD_Attach($sSession, $sString, $sMode)
 If $PageSource=_WD_Attach($sSession, $sString, $sMode) Then
;If StringInStr($sPageSource) > 0 Then


;Local $pageSource= _WD_Attach($sSession, $sString, $sMode = HTML)

LogError(" Success " & $URL)
   
Else
LogError(" Failed " & $URL)
   
_WD_DeleteSession($sSession)
_WD_Shutdown()
EndIf


Func SetupEdge()

_WD_Option('Driver', 'msedgedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--verbose')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace (@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}'

EndFunc

_WD_DeleteSession($sSession)
_WD_Shutdown()

Func LogError($ErrorString)

I was trying Autoit website for example to check how i can use the WD udf function to check the HTML code using WD functions. I was more interested in the below code like to check the HTML code and if not matching then generate the error. i added what and all tried which are commented using semicolon.

$sString = "<a href="/site/autoit/">AutoIt</a>"
$sMode = "HTML"
$PageSource=_WD_Attach($sSession, $sString, $sMode)
 If $PageSource=_WD_Attach($sSession, $sString, $sMode) Then
;If StringInStr($sPageSource) > 0 Then

;Local $pageSource= _WD_Attach($sSession, $sString, $sMode = HTML)

   LogError(" Success " & $URL)

 

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
  • Recently Browsing   0 members

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