Jump to content

Recommended Posts

Posted

Hello!

wingettext function can get the text content of the IE browser page, but the text content of the page cannot be obtained in the chrome browser? What should I do?

Posted

hello

first of all read the linked posts...

to help you we need more information about the site you want to access...

regards

why do i get garbage when i buy garbage bags? <_<

Posted

For example, the site www.google.com. Wingettext can get its page text content when using IE browser, but can't get its page text content when using chrome browser. Did I make it clear?

Posted (edited)
3 hours ago, meety said:

Did I make it clear?

Very clear.  With Chrome you cannot use _IE* functions.  You need to use WebDriver as you were already told.  We will not spoon-feed you with the code.  You will need to go thru Wiki to learn how to install WebDriver, then go thru all examples (and other materials) to understand how it is working.  After creating your script, if you still have problem, please come here with your code, and we will gladly help you out.

Edited by Nine
Posted
12 hours ago, Nine said:

Very clear.  With Chrome you cannot use _IE* functions.  You need to use WebDriver as you were already told.  We will not spoon-feed you with the code.  You will need to go thru Wiki to learn how to install WebDriver, then go thru all examples (and other materials) to understand how it is working.  After creating your script, if you still have problem, please come here with your code, and we will gladly help you out.

Can you give an example, such as using with wingettext to fetch the text content on the page?thank you!

Posted

After downloading all the required documents listed in my first link above, install them in one folder. Then you should study _wd_demo.au3 and wiki page to understand how it works. For getting the text of a web page, you can try this:
 

#include "wd_core.au3"

Local $sDesiredCapabilities, $sSession
$_WD_DEBUG = $_WD_Debug_Info
$_WD_ERROR_MSGBOX = False
SetupChrome()
If Not ProcessExists("chromedriver.exe") Then
    _WD_Startup()
EndIf
If @error <> $_WD_ERROR_Success Then
    Exit
EndIf

$sSession = _WD_CreateSession($sDesiredCapabilities)
If @error <> $_WD_ERROR_Success Then
    Exit
EndIf

_WD_Navigate($sSession,  "https://google.com")
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body")
$sText = _WD_ElementAction($sSession, $sElement, "text")

MsgBox(0, '', $sText)

Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}}'
EndFunc

 

Posted
53 minutes ago, CYCho said:

After downloading all the required documents listed in my first link above, install them in one folder. Then you should study _wd_demo.au3 and wiki page to understand how it works. For getting the text of a web page, you can try this:
 

#include "wd_core.au3"

Local $sDesiredCapabilities, $sSession
$_WD_DEBUG = $_WD_Debug_Info
$_WD_ERROR_MSGBOX = False
SetupChrome()
If Not ProcessExists("chromedriver.exe") Then
    _WD_Startup()
EndIf
If @error <> $_WD_ERROR_Success Then
    Exit
EndIf

$sSession = _WD_CreateSession($sDesiredCapabilities)
If @error <> $_WD_ERROR_Success Then
    Exit
EndIf

_WD_Navigate($sSession,  "https://google.com")
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body")
$sText = _WD_ElementAction($sSession, $sElement, "text")

MsgBox(0, '', $sText)

Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}}'
EndFunc

 

Thank you for your answer. My requirement is to monitor whether an open page changes. So I thought of using wingstext to fetch the content of the page regularly to determine whether the page has changed

Posted (edited)

Hello!

I have a requirement to open www.google.com with chrome and keep it open, and then periodically check the text on the page to determine whether the page has changed. Can this autoit be realized?

Edited by meety
Posted (edited)
10 hours ago, meety said:

I have a requirement to open www.google.com with chrome and keep it open, and then periodically check the text on the page to determine whether the page has changed.

Why do you think the content of a Google search result would dynamically change without any user intervention?

Edited by TheXman

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
×
×
  • Create New...