Jump to content

Query SIM Card ICC ID Using FF.au3


Recommended Posts

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:

  1. Login to the system
  2. Click on the site map
  3. After site map opens, go to customer care
  4. Then change subscriber information
  5. Input the MSISDN (phone number) of subscriber and submit
  6. 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.

01 - Login.png

02 - Site Map.png

03 - Customer Care.png

04 - Change Subscriber Info.png

05 - Query Inputs.png

06 - SIM Card ICC ID Number.png

TY.

Link to comment
Share on other sites

Hello,

I'm using this for my work with the billing system.

It's used to create subscriber, register or change information on the billing system.

I have tried this on internet explorer too, but couldn't go further.

Any idea for how to get the XPath working?

TY.

Link to comment
Share on other sites

  • Moderators

taylansan,

if you are using this for "your work with the billing system", why are you having to go through the standard customer login process? Surely if you are working for the company you have specialised tools for this sort of thing rather than looking to automate a standard browser?

I am afraid what you want to do looks extremely suspicious and I would like some good explanations of exactly what all this is about before we go any further.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi M23,

Actually, we have faced with an issue for the tax payer of the subscribers. Due to a wrong installation package, some of the postpaid subscribers tax flag are set as "NO", but these subscribers should be set as "NO". We have around 30k postpaid subscribers whose taxation flag is set as wrong.

Solution-1: Also, I have checked with RND team, they gave the solution to modify the taxation flag through the physical database. Yet, RND people prepared the SQL script to modify the tax flag for those subscribers. We were ready to run the script to fix the issue and scheduled to run two days ago at night time, because the night time is the less traffic for voice call or data usage. It's the standard thing in the telecom sector.

After this step, we found that, modification on the physical database is not enough and cancelled the process. The reason is; we had ram-db too, it's called as gmdb. This is used for real time charging which we need to respond to core network in short time around 50~100 ms. But the modification on the ram-db would cause unique key problems because we cannot synchronize from the physical database. So, we didn't continue SQL operation.

The way is to run modify the subscriber information through the system GUI. One by one, for each MSISDN, query the subscriber information and modify the taxation flag. Because if it's done through the GUI, the synchronization is attached to both physical db and ram-db. But it's quite tiring and takes a lot of effort to track the pages one by one.

Solution-2: Pixel reading for each page and simulate click event. Yet, I have done it too (hopelessly). But it's only working on my screen, because for others computer, the screen resolution is different. I have compiled it, and of course didn't work for others. Here is the sample for pixel thing:

HotKeySet("{F6}", "_exit")

Global $pSubsLink[2], $pHome

_getHome()

_openChangeSubscriberInfoPage()
_enterMSISDNAndSearch()
_modifyTaxationFlag()
_submitAndPayment()

Func _submitAndPayment()
   ;wait for submit and payment page comes - 87, 186
   While 1
      If PixelGetColor($pHome[0] + 19, $pHome[1] + 61) = 0xC48E54 Then
         ExitLoop
      EndIf
   WEnd
   ;
   ;check the previous button 95, 548 then shift to submit button
   While 1
      $a = PixelSearch(0, 0, 1000, 1000, 0xDADAC1)
      If Not @error Then
         ;235, 548
         MouseMove($a[0] + 140, $a[1], 0)
         ExitLoop
      EndIf
   WEnd
EndFunc

Func _modifyTaxationFlag()
   ;wait for Change Subscriber Info editable page appears 530, 158
   While 1
      If PixelGetColor($pHome[0] + 462, $pHome[1] + 33) = 0xE98C39 Then
         MouseMove(97, 332, 0)
         ExitLoop
      EndIf
   WEnd
   ;wait for taxation box appears - page loaded - 245, 323
   While 1
      If PixelGetColor($pHome[0] + 177, $pHome[1] + 198) = 0x7F9DB9 Then
         ExitLoop
      EndIf
   WEnd
   ;flag yes 253, 330 or no 254, 330
   While 1
      If PixelGetColor($pHome[0] + 185, $pHome[1] + 205) = 0xFFE1A0 Then
         ;ConsoleWrite("YES" & @CRLF)
         ;TYTY
         ;Return
      ElseIf PixelGetColor($pHome[0] + 186, $pHome[1] + 205) = 0xFFE1A0 Then
         ;ConsoleWrite("NO" & @CRLF)
         ExitLoop
      Else
         MsgBox(0, "Warning", "Cannot find the taxation flag for: " & $MSISDN)
         Exit
      EndIf
   WEnd
   ;open drop down 347, 337 and click YES
   MouseClick("left", $pHome[0] + 279, $pHome[1] + 212, 1, 0)
   Sleep(200)
   MouseClick("left", $pHome[0] + 279, $pHome[1] + 227, 1, 0)
   ;check if YES is okay - same as above
   While 1
      If PixelGetColor($pHome[0] + 185, $pHome[1] + 205) = 0xFFE1A0 Then
         ExitLoop
      EndIf
   WEnd
   ;check if Next button is moved up - 355, 400 - and click Next button
   While 1
      If PixelGetColor($pHome[0] + 287, $pHome[1] + 275) = 0xFFC17F Then
         MouseClick("left", $pHome[0] + 287, $pHome[1] + 275, 1, 0)
         ExitLoop
      EndIf
   WEnd
EndFunc

Func _enterMSISDNAndSearch()
   ;enter MSISDN 338, 184
   MouseClick("left", $pHome[0] + 270, $pHome[1] + 59, 1, 0)
   ;Send("552237755")
   Send("552096410")
   ;click search 1318, 295
   MouseClick("left", $pHome[0] + 1250, $pHome[1] + 170, 1, 0)
EndFunc

Func _openChangeSubscriberInfoPage()
   ;wait service no appears 65, 179
   While 1
      ;320, 255
      MouseClick("left", $pHome[0] + 255, $pHome[1] + 130, 1, 0)
      If PixelGetColor($pHome[0] - 3, $pHome[1] + 54) = 0x335899 Then
         ;ConsoleWrite(Hex(PixelGetColor($pHome[0] - 3, $pHome[1] + 54)) & @CRLF)
         ExitLoop
      EndIf
   WEnd
EndFunc

Func _getHome()
   While 1
      ;68, 125
      $pHome = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xA1BD85)
      ;$pHome = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xA7C38B)
      If Not @error Then
         ;MouseMove($pHome[0], $pHome[1], 0)
         ;ConsoleWrite($pHome[0] & " " & $pHome[1] & @CRLF)
         ExitLoop
      EndIf
   WEnd
EndFunc

Func _exit()
   Exit
EndFunc

Solution-3: Using this automation that I have mentioned. If I was able to make it according to reading values on the page, I don't need to scan and search pixel for this. Yet, it will work for everybody too. That's the point where I'm asking about help.

Thanks.

TY.

Link to comment
Share on other sites

  • Moderators

taylansan,

Thanks, I am closing the thread for the moment while we digest all of that - I will let you know the result ASAP.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

taylansan,

We have now discussed the matter internally. We cannot believe that a major telecomms company would need to automate their own customer-facing website to adjust the internal database for some 30k customers. Add to this the fact that it would take several weeks to run that many iterations of the required actions (even assuming a faster response that is usual from such a site) and we do not accept this as a request which we are prepared to support.

The thread stays locked - no appeal.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...