MRAJ Posted September 7, 2020 Posted September 7, 2020 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.
Danp2 Posted September 7, 2020 Posted September 7, 2020 Hello again... What have you tried? 1 hour ago, MRAJ said: Can we use _WD_Attach($sSession, $sString, $sMode = HTML) You can answer your own questions if you examine this function and how it retrieves the page's HTML. 😲 Latest Webdriver UDF Release Webdriver Wiki FAQs
MRAJ Posted September 7, 2020 Author Posted September 7, 2020 expandcollapse popup#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)
Danp2 Posted September 7, 2020 Posted September 7, 2020 20 minutes ago, MRAJ said: $PageSource=_WD_Attach($sSession, $sString, $sMode) You can't use _WD_Attach to retrieve HTML code. There is a function that you can use. Go back and reread my prior post for a hint on how to identify it Latest Webdriver UDF Release Webdriver Wiki FAQs
MRAJ Posted September 7, 2020 Author Posted September 7, 2020 Thanks. I tried to use the below and its working. If StringInStr(_WD_GetSource($sSession), $sString)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now