meety Posted December 1, 2020 Posted December 1, 2020 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?
CYCho Posted December 1, 2020 Posted December 1, 2020 @Danp2 created a wonderful webdriver UDF for FireFox, Chrome and Edge. Please take a look at the following posts: zPlayer - A Small Audio and Video Player
Aelc Posted December 2, 2020 Posted December 2, 2020 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?
meety Posted December 2, 2020 Author Posted December 2, 2020 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?
FrancescoDiMuro Posted December 2, 2020 Posted December 2, 2020 (edited) @meety If you want to retrieve something that is inside the page (a text from a DOM element), then you can use IE UDF; if that's not the case, then, as stated above, you need to be more explicit and provide a working sample Edited December 2, 2020 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
meety Posted December 2, 2020 Author Posted December 2, 2020 Thank you, I want to use wingettext to get the text on the page to determine whether the page has changed.
Nine Posted December 2, 2020 Posted December 2, 2020 (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 December 2, 2020 by Nine Danp2 and CYCho 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
meety Posted December 3, 2020 Author Posted December 3, 2020 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!
meety Posted December 3, 2020 Author Posted December 3, 2020 Has any developer come to look at this issue?
CYCho Posted December 3, 2020 Posted December 3, 2020 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 zPlayer - A Small Audio and Video Player
meety Posted December 3, 2020 Author Posted December 3, 2020 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
meety Posted December 3, 2020 Author Posted December 3, 2020 (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 December 3, 2020 by meety
Nine Posted December 3, 2020 Posted December 3, 2020 And how is it different from your other thread ? https://www.autoitscript.com/forum/topic/204539-wingettxt-function-usage-problem/ “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
meety Posted December 3, 2020 Author Posted December 3, 2020 12 minutes ago, Nine said: And how is it different from your other thread ? https://www.autoitscript.com/forum/topic/204539-wingettxt-function-usage-problem/ Express more clearly.
Moderators JLogan3o13 Posted December 3, 2020 Moderators Posted December 3, 2020 @meety Please stick to one thread per topic. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
TheXman Posted December 3, 2020 Posted December 3, 2020 (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 December 3, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Danp2 Posted December 3, 2020 Posted December 3, 2020 @TheXman Guessing that he hasn't share the actual website with us. 🤨 Latest Webdriver UDF Release Webdriver Wiki FAQs
meety Posted December 4, 2020 Author Posted December 4, 2020 4 hours ago, Danp2 said: @TheXman猜测他没有与我们共享实际的网站。🤨 Yes, goolge website is just an example
meety Posted December 4, 2020 Author Posted December 4, 2020 7 hours ago, JLogan3o13 said: @meety Please stick to one thread per topic. got it!
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