Jump to content

Recommended Posts

Posted (edited)

Please help! I am trying to click on the 'data bundles' link, as shown on screenshot.

This is error msg from FF.au3:

_FFLinkClick ==> No match: $vSearch: https://www.vodacom4me.co.za/vodacom4me-per...?operation=init

I tried using FFLinksGetAll but I get error:

_FFLinksGetAll ==> No match

I don't know what I'm doing wrong. Here is my code:

CODE
#include <FF.au3>

#include <Array.au3>

$sUserName = "xxxxxxx"

$sPassWord = "xxxxx"

_FFConnect()

If _FFIsConnected() Then

_FFTabAdd("https://www.vodacom4me.co.za/vodacom4me-personal/logout.do")

;_FFOpenURL("https://www.vodacom4me.co.za/vodacom4me-personal/logout.do")

_FFCmd(".forms[0].elements[0].value='" & $sUserName & "'")

_FFCmd(".forms[0].elements[2].value='" & $sPassWord & "'")

_FFFormSubmit(0)

$aLinks = _FFLinksGetAll()

_ArrayDisplay($aLinks)

_FFLinkClick("https://www.vodacom4me.co.za/vodacom4me-personal/dataBundles.do?operation=init ")

EndIf

Edited by dmob
Posted

The screenshot from the FF-Page-Analyzer looks like you have analyzed frame[1] but you never changed to it in your program with _FFFrameEnter(1)

And instead of using this URL you can do

_FFLinkClick("data bundles", "text")

too, or any substring of it.

Posted (edited)

Can you post the array after you submit the first form, using _ArrayDisplay(). Also, try to expand the column to see the whole link href, or text.

No array since _FFLinksGetAll() returns an error.

@stilgar

I have tried both - no luck; here is the console output

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.3.0.0

_FFConnect: FF.au3: 0.5.3.5b-0

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1712

__FFSend: try{window.content.frames["top"].document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10

__FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';};

__FFRecv: 1

__FFSend: try{gBrowser.selectedTab = gBrowser.addTab('https://www.vodacom4me.co.za/vodacom4me-personal/logout.do')}catch(e){'_FFCmd_Err';};

__FFRecv: [object XULElement] â {linkedBrowser: {â¦}, _tPos: 6, __SS_extdata: {â¦}, mOverCloseButton: false, mCorrespondingMenuitem: null, arrowKeysShouldWrap: false, accessibleType: 4119, ...}

_FFLoadWait: ........ loaded in 2281ms

__FFSend: try{window.content.frames["top"].document.forms[0].elements[0].value='User'}catch(e){'_FFCmd_Err';};

__FFRecv: 0790939427

__FFSend: try{window.content.frames["top"].document.forms[0].elements[2].value='Pass'}catch(e){'_FFCmd_Err';};

__FFRecv: 627960

__FFSend: try{window.content.frames["top"].document.forms[0].elements.length;}catch(e){'_FFCmd_Err';};

__FFRecv: 4

__FFSend: try{window.content.frames["top"].document.forms[0].submit();}catch(e){'_FFCmd_Err';};

__FFRecv:

_FFLoadWait: ..................... loaded in 8227ms

__FFSend: try{window.content.frames["top"].document.links.length}catch(e){'_FFCmd_Err';};

__FFRecv: 0

_FFLinksGetAll ==> No match

__FFSend: try{content.frames.length}catch(e){'_FFCmd_Err';};

_FFLinksGetAll ==> General Error

__FFRecv: 4

__FFSend: try{content.frames[1].document.location.href}catch(e){'_FFCmd_Err';};

__FFRecv: https://www.vodacom4me.co.za/vodacom4me-per...sp?uid=64342368

__FFSend: try{FFau3.SearchLink("href","https://www.vodacom4me.co.za/vodacom4me-personal/dataBundles.do?operation=init",1);}catch(e){'_FFCmd_Err';};

__FFRecv: 17

__FFSend: try{FFau3.simulateClick(window.content.frames[1].document.links[17],0,0);}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{FFau3.simulateClick(window.content.wrappedJSObject.frames[1].document.links[17],0,0);}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFClick ==> No match: $sElement: window.content.document.links[17]

__FFSend: try{FFau3.SearchLink("text","data bundles",1);}catch(e){'_FFCmd_Err';};

_FFLinkClick ==> No match: $vSearch: https://www.vodacom4me.co.za/vodacom4me-per...?operation=init

__FFRecv: 17

__FFSend: try{FFau3.simulateClick(window.content.frames[1].document.links[17],0,0);}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{FFau3.simulateClick(window.content.wrappedJSObject.frames[1].document.links[17],0,0);}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFClick ==> No match: $sElement: window.content.document.links[17]

_FFLinkClick ==> No match: $vSearch: data bundles

and the code:

CODE
#include <FF.au3>

#include <Array.au3>

$sUserName = "User"

$sPassWord = "Pass"

_FFConnect()

If _FFIsConnected() Then

_FFTabAdd("https://www.vodacom4me.co.za/vodacom4me-personal/logout.do")

;_FFOpenURL("https://www.vodacom4me.co.za/vodacom4me-personal/logout.do")

_FFCmd(".forms[0].elements[0].value='" & $sUserName & "'")

_FFCmd(".forms[0].elements[2].value='" & $sPassWord & "'")

_FFFormSubmit(0)

$aLinks = _FFLinksGetAll()

_ArrayDisplay($aLinks)

_FFFrameEnter(1)

_FFLinkClick("https://www.vodacom4me.co.za/vodacom4me-personal/dataBundles.do?operation=init")

_FFLinkClick("data bundles", "text")

EndIf

Edited by dmob
Posted

Strange here your script works.

Ok _FFLinksGetAll doesn't work, but it wouldn't work with the "top" frame if there isn't an <noframe> section.

Have you tried to download the FF.au3 again? I currently can't see any error here.

The strange thing is this:

__FFSend: try{FFau3.SearchLink("href","https://www.vodacom4me.co.za/vodacom4me-personal/dataBundles.do?operation=init",1);}catch(e){'_FFCmd_Err';};
__FFRecv: 17
__FFSend: try{FFau3.simulateClick(window.content.frames[1].document.links[17],0,0);}catch(e){'_FFCmd_Err';};
__FFRecv: _FFCmd_Err

the link is found but the "click" doesn't work.

Posted (edited)

@stilgar

Thank you for your response. As always you offer great and prompt support for your UDF's.

the script works now with the _FFLinkClick("data bundles", "text"), and I can now get

to the page I want.

My problem now is I am trying to read the text (which seems to be in a table) as shown in screenshot.

_FFReadText does not show the text.

_FFTableWriteToArray returns an error

_FFTableGetCell returns no match (tried with various options)

FF_PageAnalyser does not show the text or table.

My last problem was (I gather) with the frame. I don't know if it is now, but I don't know much about frames or HTML.

Any help would be appreciated.

Code:

CODE
#include <FF.au3>

#include <Array.au3>

$sUserName = "User"

$sPassWord = "Pass"

If Not _FFIsConnected() Then

_FFConnect()

EndIf

_FFTabAdd("https://www.vodacom4me.co.za/vodacom4me-personal/logout.do")

;_FFOpenURL("https://www.vodacom4me.co.za/vodacom4me-personal/logout.do")

_FFCmd(".forms[0].elements[0].value='" & $sUserName & "'")

_FFCmd(".forms[0].elements[2].value='" & $sPassWord & "'")

_FFFormSubmit(0)

$aLinks = _FFLinksGetAll()

_ArrayDisplay($aLinks)

_FFFrameEnter(1)

_FFLinkClick("data bundles", "text")

;~ _FFTabSetSelected("Vodacom4Me", "label")

;~ $sText = _FFReadText(1+2+4+8)

;~ ConsoleWrite("$sText = " & $sText & @CRLF)

;~ $aTable = _FFTableWriteToArray(0)

;~ _ArrayDisplay($aTable)

$sText = _FFTableGetCell(1, 1, 1)

ConsoleWrite("$sText = " & $sText & @CRLF)

post-35502-1243344179_thumb.jpg

Edited by dmob
Posted (edited)

This could be a problem with nested tables. If you don't know which table you should "use" then it's a problem to use the _FFTable*- functions.

The best thing in this case is, you install the AddOn "Xpather" and copy via. the context-menu the xpath from the element where you wanna read the text and then use _FFXpath with the result from XPather.

This would look like this:

$sText = _FFXPath("/html/body/div/table/tbody/tr/td/table[2]/tbody/tr/td[@class='lightblueborder']/table/tbody/tr/td[1]")

-> shortcut:

$sText = _FFXPath("//table[2]//td[@class='lightblueborder']//td[1]")

You can try this expressions in the XPather-Addon.

It's simpler to use like FireBug or the DOM-Inspector.

Edited by Stilgar
Posted

@stilgar,

I've said this about you before, and I will say it again now - YOU ARE THE MAN.

I have it working like a charm now and I'm very very happy.

Thank you ever so much for your help.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...