Jump to content
Sign in to follow this  
radufly

Refresh the HTML code (not page) on dynamic pages.

Recommended Posts

radufly

Hi guys,

Hope I'm not posting something that has been answer perviously, but I couldn't find anything near my problem.

So what I'm trying to do is use autoit to go to the dropbox site and export the users that have access to a certain folder.

The problem is after the script clicks the "view shared folder options" button the page changes dinamically (a simulated pop-up appears) and I can see that in Internet Explorer but the source code (in developer tools) does not change untill I click "refresh" on the developer tools tab. So after that my script does not find the divs that i want because practically they don't exist in the HTML code.

How can I solve this?

Previously I had this issue on the same dropbox site but I used to resolve this issue by using _IEAction with "refresh" arg, but I can't use this as the pop-up disappears if I do.

Here is my code:

#include <IE.au3>
#include <Array.au3>

Global $oIE= _IECreate("https://www.dropbox.com/home/MyFolder")

$pMessage=_IEBodyReadText($oIE)
If StringInStr($pMessage, "Sign in") Then
$oUser=_IEGetObjById($oIE, "login_email")
$oPass=_IEGetObjById($oIE, "login_password")
$oSubmitLogin=_IEGetObjById($oIE, "login_submit")
_IEFormElementSetValue($oUser, "user@name.com")
_IEFormElementSetValue($oPass, "password")
_IEAction($oSubmitLogin, "click")
_IELoadWait($oIE)
EndIf
Sleep(2500)
_IELoadWait($oIE)
_IEAction($oIE, "refresh")
Sleep(2000)
$oShareButton=_IEGetObjById($oIE, "global_share_button")
_IEAction($oShareButton, "click")
Sleep(6500)

$oMembersContainer=_IEGetObjById($oIE, "sf-members-container")
$oMembersDivs=_IETagNameGetCollection($oMembersContainer, "div")
For $oMembersDiv In $oMembersDivs
$class_value=$oMembersDiv.className
If String($class_value)="bs-row clearfix clear hover" Then
  $msg=String(_IEPropertyGet($oMembersDiv, "innertext"))
  MsgBox(0, "test", $msg)
EndIf
Next

Basically nothing happens after the click on ShareButton because what I'm searching for is not found in the source code.

Hope someone can help.

Thanks !

Share this post


Link to post
Share on other sites
DaleHohm

I'd suggest using DebugBar instead of what you are using and the source for the "simulated popup" is readily available.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
radufly

Thanks for responding Dale !

The propblem isn't that I don't see the code for the "simulated popup" which is actually a div.

The problem is that the script doesn't "see" it because it is created dinamycally....

Share this post


Link to post
Share on other sites
DaleHohm

You have misconceptions about the DOM. If it is active in the browser, it is accessible by your script (with the exception of cross-domain security restrictions with frames, but that is not your problem here - I've looked at the site).

Prove it to yourself with:

ConsoleWrite(_IEDocReadHTML($oIE) & @CRLF)

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
radufly

Thanks a lot Dale !

You are absolutely right! all the code is there and by inspecting it properly I actually found out that the problem was that there was a space at the end of th class name: "bs-row clearfix clear ".

I also have another issue but about triggering a javascript function, but I'll first try to waste all the possibilities and probably create a new thread.

Again, many thanks.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×