Jess Posted August 11, 2017 Share Posted August 11, 2017 Hi, I am writing a script where in I have to go to particular tab inside a website and write all the data in that div to word and also show it in a msgbox. I have written a code but it showing errors.Please review the script. Thanks $divs = _IETagNameGetCollection($oIE, "div") For $div In $divs If $div.className == "yui3-tab-panel yui3-tab-panel-selected" Then MsgBox(0, "text", $div.innerText) EndIf Next Link to comment Share on other sites More sharing options...
Neutro Posted August 11, 2017 Share Posted August 11, 2017 (edited) Hi @Jess, Quote and write all the data in that div to word Do you mean that you want to copy the content of a portion of a specific website which contains this specific div classname to Microsoft Word? It would help if you could provide the website's url also Edited August 11, 2017 by Neutro Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water! Link to comment Share on other sites More sharing options...
Jess Posted August 11, 2017 Author Share Posted August 11, 2017 Hi, Yes you are correct . I am trying to retrieve the data in this div specific classname of a website. Can You help me in that? Thanks Link to comment Share on other sites More sharing options...
Neutro Posted August 11, 2017 Share Posted August 11, 2017 (edited) I'll try Can you provide the url of the website that you're trying to retreive data from, or a substitute that can be used as an example? Edited August 11, 2017 by Neutro Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water! Link to comment Share on other sites More sharing options...
Jess Posted August 11, 2017 Author Share Posted August 11, 2017 Url : https://cmooc.cognizant.com Can this be done in chrome as well? or only in IE? Thanks Link to comment Share on other sites More sharing options...
Neutro Posted August 11, 2017 Share Posted August 11, 2017 There is no div with the classname " yui3-tab-panel yui3-tab-panel-selected in the url that you provided, but i guess you are refering to a page you get after you login to that website. #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("https://developer.mozilla.org/fr/docs/Web/API/Node/textContent", 1) $divs = _IETagNameGetCollection($oIE, "div") For $div In $divs If $div.className = "wrap center" Then MsgBox(0, "text", $div.innertext) EndIf Next _IEQuit($oIE) Your solution is working if the classname "yui3-tab..." exists for a specific div element and contains text in the webpage you are looking for. If you have errors with it, it might be because the classname does not exists in the url/webpage you are searching into. Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water! Link to comment Share on other sites More sharing options...
Jess Posted August 11, 2017 Author Share Posted August 11, 2017 Hi, This is the error I am getting IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType thanks Link to comment Share on other sites More sharing options...
Jess Posted August 11, 2017 Author Share Posted August 11, 2017 url : https://cmooc.cognizant.com/course/view.php?id=33 That class name is there in this url. Please see to it. Here is the code #include <GuiTab.au3> #include<String.au3> #include <AutoItConstants.au3> #include <IE.au3> #include <Array.au3> ; Run Google Chrome Run("C:\Program Files\Google\Chrome\Application\chrome.exe") ;$oIE = _IECreate("https://cmooc.cognizant.com/") WinWaitActive("[Intermediate D3D Window]","",10) ; Open a new tab with Ctrl+t Sleep(9000) Send("https://cmooc.cognizant.com/{ENTER}") ; Type the address and press Enter in one command Sleep(5000) Send('{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}') sleep(7000) MouseClick( $MOUSE_CLICK_PRIMARY,528,623) Local $oDiv = _IEGetObjById($oIE, "section-1") ;$divs = _IETagNameGetCollection($oIE, "div") For $div In $divs If $div.className == "yui3-tab-panel yui3-tab-panel-selected" Then MsgBox(0, "text", $div.innerText) EndIf Next Link to comment Share on other sites More sharing options...
Neutro Posted August 11, 2017 Share Posted August 11, 2017 (edited) Only you can access this url because you're already logged to this website If you logout and try to connect to it again, it goes back to https://cmooc.cognizant.com But please DO NOT SEND YOUR LOGIN / PASSWORD to anyone, including me So basicly you are trying to retrieve data from a website of a company from which you are a customer from? Most of the time companies like cognizant for you have APIs they develop to do precisely what you are trying to do. Instead of having troubles doing this manually, you should try to contact their support first, explain them what you are trying to achieve and ask them if they have an API that you could use to do it Edited August 11, 2017 by Neutro Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water! Link to comment Share on other sites More sharing options...
Danp2 Posted August 11, 2017 Share Posted August 11, 2017 13 minutes ago, Jess said: Hi, This is the error I am getting IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType thanks You can't use the _IE* functions with Chrome. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jess Posted August 11, 2017 Author Share Posted August 11, 2017 Ok Thanks for your support Neutro 1 Link to comment Share on other sites More sharing options...
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