MRAJ Posted May 11, 2018 Author Share Posted May 11, 2018 How to save the complete HTML page..it is difficult one by one. Link to comment Share on other sites More sharing options...
Earthshine Posted May 11, 2018 Share Posted May 11, 2018 I would copy the whole site using this, copy local and look at all that code... https://www.httrack.com/ Danp2 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
MRAJ Posted May 14, 2018 Author Share Posted May 14, 2018 (edited) Attach is HTML page. Edited May 14, 2018 by MRAJ Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 Try this -- $oLink = _IEGetObjById($oIE, "ygtvlabelel4") _IEAction($oLink, "click") If that doesn't work, then try -- $oLink = _IEGetObjById($oIE, "ygtvlabelel4") $oLink.onclick() Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MRAJ Posted May 14, 2018 Author Share Posted May 14, 2018 Its not working still. Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 49 minutes ago, MRAJ said: Its not working still. Your reply is about as helpful as my code. Looking at the html, it appears that the site is using an older version of the YUI library, which can be tricky to automate. My only suggestion at this stage is for you to use the browser's console (I prefer Firefox for this) to interact with the control to determine the steps to manually trigger the desired action. Once you can do it manually from the console, then it should be easier to automate. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MRAJ Posted May 14, 2018 Author Share Posted May 14, 2018 I didnt understand this (control to determine the steps to manually trigger the desired action. Once you can do it manually from the console, then it should be easier to automate.) is there any command other then IENavigate, which will take the other page but parent URL should be same. Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 @MRAJ This is what I was suggesting that you do -- Load the website in Firefox Navigate to the page containing the Public Folders link Right click on this link and select "Inspect Element" from the popup menu This will open the Developer Tools with the desired element already highlighted. Right click on the highlighted link entry in the Developers Tools window and select "Use in Console" from the popup window This will give you a variable (likely named `temp0') that will allow you to try different commands with this control, such as -- temp0.click() temp0.onclick() If neither of those work, then try something like this, which came directly from the HTML file you posted -- YAHOO.widget.TreeView.getNode('ListingURE_treeContent_Inner',4).toggle() All of this is done directly in the browser window; no need for Autoit until you can figure out how to manually perform the desired action. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MRAJ Posted May 14, 2018 Author Share Posted May 14, 2018 How to click using href..can you please provide me sample script Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 10 minutes ago, MRAJ said: How to click using href..can you please provide me sample script Are you unwilling to performing the above actions as requested? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MRAJ Posted May 14, 2018 Author Share Posted May 14, 2018 actually we are running all applications in IE not in mozilla firefox...and i am not able to perform on my system due to some restrictions. Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 Fine... then you should be able to perform similar steps in IE. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MRAJ Posted May 14, 2018 Author Share Posted May 14, 2018 I am not able to find "Use in Console" from the popup window Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 Right... I did say similar. In this case, you have to create the variable yourself, like this -- temp0=document.getElementById('ygtvlabelel4') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted May 14, 2018 Share Posted May 14, 2018 Try iuiautomation and read faq 31 although i feel ie.udf should normally be able to find your element. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2018 Share Posted May 14, 2018 AFAIK, the issue isn't finding the element. It's clicking on it and triggering any associated events to cause the tree to expand. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted May 14, 2018 Share Posted May 14, 2018 (edited) If you have found it you know x y and w h so you can move mouse and click. Many elements in modern js frameworks have a mirrored shadow tree (https://www.w3.org/TR/shadow-dom/) so directly calling click event will not trigger the js code as on the span itself there is no click code event. Simplespy helps partly in this as it will give you the id a little easier the ie get collection functions (see next post for example code). Edited May 14, 2018 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
junkew Posted May 14, 2018 Share Posted May 14, 2018 example expandcollapse popup#include <IE.au3> Local $oIE = ObjCreate("InternetExplorer.Application") If @error Then MsgBox($MB_SYSTEMMODAL, "", "Error opening Internet Explorer: " & @error) Exit EndIf $oIE.Visible = 1 $oie.navigate2("about:blank") Local $sHTML = '' $sHTML &= '<!DOCTYPE html>' & @CR $sHTML &= '<html>' & @CR $sHTML &= '<head>' & @CR $sHTML &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR $sHTML &= '<title>Span example</title>' & @CR $sHTML &= '</head>' & @CR $sHTML &= '<body>Hello world... wait a moment will add some spans' & @CR $sHTML &= '</body>' & @CR $sHTML &= '</html>' $oie.document.body.innerhtml=$sHtml ;~ sleep(2000) $sHTML &= '<!DOCTYPE html>' & @CR $sHTML &= '<html>' & @CR $sHTML &= '<head>' & @CR $sHTML &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR $sHTML &= '<title>Span example</title>' & @CR $sHTML &= '</head>' & @CR $sHTML &= '<body>Hello world... Wait I will move some spans with mouse' & @CR local $i=0 for $i=1 to 10 $shtml &= '<span> span ' & $i & '</span><br>' & @CR Next $sHTML &= '</body>' & @CR $sHTML &= '</html>' $oie.document.body.innerhtml=$sHtml ;~ sleep(2000) local $spanElements $spanElements=$oie.document.getElementsByTagName("span") consolewrite("Hooray we found " & $spanElements.length & " elements") local $el ;~ local $boundingRect for $i=8 to 0 step -2 $el=$spanelements.item($i) ;~ $boundingRect=$el.getboundingclientrect() local $x=_IEPropertyGet($el, "screenx") local $y=_IEPropertyGet($el, "screeny") mousemove($x, $y) mouseclick("left", $x,$y) sleep(200) Next In general I would advice to use internet explorer first from a VBA macro (with references to Microsoft Internet Controls (Internetexplorer.application) and microsoft html controls as with the debugger its much easier to inspect the tree and all properties. Learning IE object model from within AutoIt can be painfull and time consuming. in above example I am 99% sure in your scenario $el.click will not work and as such you have to use mousemove and/or mouseclick or click Within the loop you can filter with innerhtml, outhtml or any other html property (like id, name, ... ) so instead of using getelementbyid or getelementbyclassname you use getelementsbytagname (in your case its a span but div works fine to) FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MRAJ Posted May 15, 2018 Author Share Posted May 15, 2018 I confused here, what exactly to do..or please provide me the sample script for that or any portion in FAQ 31 where i can perform the steps. Link to comment Share on other sites More sharing options...
Earthshine Posted May 15, 2018 Share Posted May 15, 2018 (edited) he just did provide a working example. it worked for me. If you want examples of IUIAutomation, in @junkew's kit, it has many examples, including automating browsers. EXAMPLES_V0_66.zip UIA_V0_66.zip Edited May 15, 2018 by Earthshine My resources are limited. You must ask the right questions 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