Sign in to follow this  
Followers 0
danielzy

Trying to use FF.au3 to extract some information from a table

2 posts in this topic

Hey guys, I'm pretty new to autoit and I'm trying to use FF.au3 to extract some cells from a table which looks like that:

 

<table border="0" cellspacing="5" cellpadding="1">
        <tr>
            <td class="BlueInputKind" align="left" nowrap>HEADING1</td>
            <td  class="BlueInputKind" nowrap>HEADING2</td>
            <td class="BlueInputKind" nowrap>HEADING3</td>
            <td class="BlueInputKind" nowrap>HEADING4</td>
        </tr>
        <tr>
            <td class="BlackTextEng" dir="ltr">Text1</td>
            <td class="BlackTextCenter" valign="top"  dir="rtl">Number</td>
            <td nowrap class="BlackText" valign="top" nowrap>Text3</td>
        </tr>
        <tr>
            <td class="BlackTextEng" dir="ltr">Text1</td>
            <td class="BlackTextCenter" valign="top"  dir="rtl">Number</td>
            <td nowrap class="BlackText" valign="top" nowrap>Text3</td>
        </tr>
        <tr>
            <td class="BlackTextEng" dir="ltr">Text1</td>
            <td class="BlackTextCenter" valign="top"  dir="rtl">Number</td>
            <td nowrap class="BlackText" valign="top" nowrap>Text3</td>
        </tr>

My end goal is to:

If Text1 == something && Number > SomeNumber Then DoSomething

I managed to connect to firefox using repl and clicked some links etc but I'm not even close to achieving something like the above. Any help will be appreciated.

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  
Followers 0

  • Similar Content

    • Danp2
      By Danp2
      UDF to control FireFox via MozRepl:
       FF_V0.6.0.1b-15_au3
      Change Log:
      Original thread: http://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/
      Current development is occurring over on GitHub. The repo can be found here.
       
    • 5ervant
      By 5ervant
      Go create a quick account in Zapier and go to https://zapier.com/app/dashboard and make some Zaps!
      Just need to click the specific instance of an .open-menu button and then click its a.run (anchor) element.
      Doing this IE.au3 script just causing to click its container element:
      $target = 1; Target the first instance #include <IE.au3> $oIE = _IEAttach("Dashboard - Zapier") $count = 0; $tags = _IETagNameGetCollection($oIE, "div") For $tag in $tags $class_value = $tag.GetAttribute("class") If $class_value = "open-menu" Then $count += 1 if $count = $target Then MsgBox(0, "Instance: ", $count) ; $tag.fireEvent("onmousedown") ; _IEAction($tag, "click") ; $tag.fireEvent("onmouseup") ; Or this but not working ; $tag.Click EndIf EndIf Next I also tried to do it using FF.au3
      $target = 1; Target the first instance #Include <Array.au3> #Include <FF.au3> $count = 0; If _FFConnect(Default, Default, 3000) Then $aArray = _FFXPath( "//div[@class='open-menu']", "", 7 ) ; _ArrayDisplay($aArray) For $tag in $aArray $count += 1 if $count = $target Then MsgBox(0, "Instance: ", $count) _FFClick($tag) EndIf Next EndIf Error: _FFClick ==> No match: $sElement: [number]
      Could some help me how to click such buttons on such kind of a dynamic page?
    • jfcby
      By jfcby
      I have a script that sends multiple lines of text to a textbox using Firefox. I using _FFSetValue($sCellValue[7], "line one" & @CR & "line two", "id") from ff.au3. If it's a single line of text it works but MozRepl give the following error with multiple lines of text.
      Error:  
      __FFSend: try{FFau3.simulateEvent(window.content.top.document.getElementById('line one
      line two'),'Event','change',13);}catch(e){'_FFCmd_Err';};
      __FFWaitForRepl ==> Error return value: MozRepl ....>
      __FFSend: ;
      __FFRecv:
      __FFSend: FFau3.WCD=window.content.top.document;
      __FFWaitForRepl ==> Error return value: MozRepl ....>
      __FFRecv: !!! SyntaxError: unterminated string literal
      Details:

       [object HTMLDocument] - {mainForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, ...}
      !!! SyntaxError: unterminated string literal
      Will MozRepl plugin for Firefox send multiple lines of text to a textbox?
      Thanks for your help.
    • DrewSS
      By DrewSS
      Hello,
      I'm looking for some direction with how to automate the exporting of an excel report through a javascript driven menu; unfortunately it does not support IE, so Firefox is what i've been trying, and I can navigate all the way through the dashboard and generate the report, but to export it I need to go through the menu. The menu has onmousedown and onmouseover events that I'm not sure how to send. It looks like I can do this with _FFCmd, but it may take several statements.. can someone help me get started?
       
      This is the path to export:
       
      <div id="mstr395" tstid="" class="mstrmojo-ListBase mstrmojo-ui-Menu unselectable mojo-theme-dark visible" style="top: 0px; right: 100%; bottom: auto; left: auto;"
      onclick="mstrmojo.dom.captureDomEvent('mstr395','click', self, event)"
      ondblclick="mstrmojo.dom.captureDomEvent('mstr395','dblclick', self, event)"
      onmousedown="mstrmojo.dom.captureDomEvent('mstr395','mousedown', self, event)"
      onmouseover="mstrmojo.dom.captureDomEvent('mstr395','mouseover', self, event)"
      onmouseout="mstrmojo.dom.captureDomEvent('mstr395','mouseout', self, event)"
      oncontextmenu="mstrmojo.dom.captureDomEvent('mstr395','contextmenu', self, event)">
      <div class="mstrmojo-ui-Menu-item-container" style="">
      <a class="item exportToExcel mstrmojo-ui-Menu-item" idx="0" style="" title="">
      <div class="micn"></div>Excel</a><a class="item exportToPDF mstrmojo-ui-Menu-item" idx="1" style="" title="">
       
      Sorry I cannot provide access to the dashboard as it has sensitive information. Any feedback is greatly appreciated!
       
       
       
       
       
    • taylansan
      By taylansan
      Hello Dears,
      I'm trying to get the SIM card ICC ID number through the system using FF.au3. I have read the description of the UDF but I'm stuck on the query page after login. I have also tried to refresh the page to get the new XPath (hopelessly), but couldn't go any further. I'm basically trying to:
      Login to the system Click on the site map After site map opens, go to customer care Then change subscriber information Input the MSISDN (phone number) of subscriber and submit Get the SIM card ICC ID information and proceed to the next screen HotKeySet("{F6}", "_exit") #include <FF.au3> _01_loginPage() _02_clickSiteMap() _03_clickCustomerCare() _04_clickChangeSubscriberInfo() _05_fillPhoneNumberInfoAndSubmit() _06_getSIMCardInfo() Func _01_loginPage() $sBSSMainPage = "http://10.220.65.172:9889/login.action?ssoLogin=true" If _FFConnect() Then If _FFOpenURL($sBSSMainPage) Then _FFSetValue("TaylanY", _FFXPath(".//*[@id='username']"), "elements") _FFSetValue("WWee11!!", _FFXPath(".//*[@id='password']"), "elements") _FFClick(_FFXPath(".//*[@id='submitBtn']/div/div")) EndIf EndIf EndFunc Func _02_clickSiteMap() ;retry again and again until click the site map button While 1 Local $a = _FFXPath(".//*[@id='sitemap']/div") _FFClick($a) If Not @error Then MsgBox(0,"OK","Site Map Opening", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _03_clickCustomerCare() ;retry again and again until click the customer care button While 1 _FFClick(_FFXPath(".//*[@id='newcustomer']/div")) If Not @error Then MsgBox(0,"OK","Customer Page Opening", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _04_clickChangeSubscriberInfo() ;retry again and again until click the change subscriber info button While 1 _FFClick(_FFXPath(".//*[@id='sitemap']/div[12]/div[2]/div[2]/span[5]/a")) If Not @error Then MsgBox(0,"OK","Change Subscriber Info Page Opening", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _05_fillPhoneNumberInfoAndSubmit() ;fill the MSISDN of the subscriber and submit While 1 ;enter subscriber phone number Local $a = _FFXPath(".//*[@id='serviceNo_input_value']") _FFSetValue("552237755", $a, "elements") If Not @error Then ;click the submit button Local $b = _FFXPath(".//*[@id='searchCustomer']/div/div") _FFClick($b) If Not @error Then MsgBox(0,"OK","Submit Customer Info Waiting for Result", 1) ExitLoop EndIf EndIf Sleep(1000) WEnd EndFunc Func _06_getSIMCardInfo() While 1 ;get the ICC ID of the SIM card $SIMCardXPath = _FFXPath(".//*[@id='iccid_input_value']") $ICCIDoftheCard = _FFGetValue($SIMCardXPath) ;click next button $nextbutton = _FFXPath(".//*[@id='nextBtn']/div/divf") _FFClick($nextbutton) If Not @error Then MsgBox(0,"OK","ICC ID of the SIM card is: " & $ICCIDoftheCard & " and Next Page", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _exit() Exit EndFunc But after login to the billing system, my code cannot process the second function (clicking on site map):
      >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Taylan\Projects\AU3\BSS\test1 FF.au3" _FFConnect: OS: WIN_7 WIN32_NT 7601 Service Pack 1 _FFConnect: AutoIt: 3.3.8.1 _FFConnect: FF.au3: 0.6.0.2b _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 572 _FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; rv:44.0) Gecko/20100101 Firefox/44.0 __FFSendJavaScripts: Sending functions to FireFox .......... done _FFOpenURL: http://10.220.65.172:9889/login.action?ssoLogin=true __FFSend: try{window.content.top.document.location.href='http://10.220.65.172:9889/login.action?ssoLogin=true'}catch(e){'_FFCmd_Err';}; __FFRecv: http://10.220.65.172:9889/login.action?ssoLogin=true _FFLoadWait: .................. loaded in 4483ms [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.WCD=window.content.top.document; __FFRecv: [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='username']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLInputElement] - {stepUp: function() {...}, stepDown: function() {...}, checkValidity: function() {...}, setCustomValidity: function() {...}, select: function() {...}, setRangeText: function() {...}, setSelectionRange: function() {...}, ...} __FFSend: try{FFau3.xpath.value='TaylanY'}catch(e){'_FFCmd_Err';}; __FFRecv: TaylanY __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'Event','change',13);}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: FFau3.WCD=window.content.top.document; __FFRecv: [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='password']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLInputElement] - {stepUp: function() {...}, stepDown: function() {...}, checkValidity: function() {...}, setCustomValidity: function() {...}, select: function() {...}, setRangeText: function() {...}, setSelectionRange: function() {...}, ...} __FFSend: try{FFau3.xpath.value='WWee11!!'}catch(e){'_FFCmd_Err';}; __FFRecv: WWee11!! __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'Event','change',13);}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: FFau3.WCD=window.content.top.document; __FFRecv: [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='submitBtn']/div/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLDivElement] - {align: "center", click: function() {...}, focus: function() {...}, blur: function() {...}, title: "", lang: "", dir: "", ...} __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: 1 _FFLoadWait: . loaded in 10ms [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: FFau3.xpath __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 >Exit code: 0 Time: 13.335 I don't know why it says as a dead object to the place where I want to click. Here, you see in the screenshots that, my XPath is actually correct.
      Please advice me how to proceed from the second function till I get the subscriber information.
      Thank you in advance.