Jump to content

Multiple Logins


Recommended Posts

Hello,

Our company asked to us to put 100 different users accessing the website and performing some action. So I have written a bot script for user actions, but need to take user id and password from excel sheet for every new login. so how can i do it with Auto IT. 

There should be happening 100 logins from different id's, so that our performance testing team can observe the behaviour of the site when 100 login happens.

Kindly Help..!!

Link to comment
Share on other sites

Hello,

I'm new to AutoIT. Our company has a tool, where it can send messages and data to our website, which behaves as a substitute to real users. So I have to simulate the tool and send a request to 100 different users who have their own user id. So manually we used to open the tool and enter user id and send the request. After I came to know about Auto IT, thought of simulating the same scenario for 100-150 users. I have used mouse click to locate the position and Send command to send required data, which was easy for 10 users. For 100 users i need to take data from excel and post it tool. So need to open 100 instances for 100 users and send data to it. 

So the main query is how can I make AutoIt to take data from excel and post it on the tool.

Is there any better way to locate the empty field in the tool because i have used mouse pointer location and entering the data. I need more info and suggestions on it. Kindly help me. 

Thanks in advance. 

Link to comment
Share on other sites

  • Moderators

For the first part of your question, look at the _Excel functions in the help file. You can use these to pull data from an Excel worksheet into an array, the iterate through the array to enter the information in your tool. The third example in the _Excel_RangeRead section (while technically for formulas) will give you a good idea of how to do what you're after.

Regarding getting the info into your tool, use the AutoIt Window Info Tool (in the same directory where you installed AutoIt) and hover over the fields on your tool. If it returns information on the field itself and not just the whole window, it should be pretty easy to use ControlSend (look in the help file) to populate the fields or ControlClick to select buttons.

If, after reading through the above and trying some things on your own, you are still having problems, feel free to post your code here and we will do what we can to assist.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hello,

I have used FileReadto Array function to read from the CSV file, kindly look into the bottom code. I have attached a screenshot of my desktop application, where the red box is the place where I have to input the data taken from the CSV file. The data(patient id) taken from csv file should be one by one and start the session, then another patient id should be given in that box. So like that I have to input all those 150 patients id and create unique instances for each patient.  

 

PS: Retrieve patient id from CSV file and input it in the red box (kindly look into image attached).

 

 

#include <Array.au3>

WinActivate("Live View Session")


    

   Local $aArray = FileReadToArray("C:\Users\CS-NS6\Desktop\Automation\900915 Pids.csv")

    For $i = 0 To UBound($aArray) + 1 ; Loop through the array
        WinActivate("Live View Session")
        MouseClick("Left", 868, 143)  ; location of the patient id boxAutoit(patient id).png
        Send($aArray)
    Next

Link to comment
Share on other sites

  • Moderators

@shivacharla you're trying to send your entire array, which you obviously cannot do. Try something like this:

#include <Array.au3>

Local $aIDs = FileReadToArray(@DesktopDir & "\IDs.csv")
    For $sID In $aIDs
        WinActivate("Live View Session")
        MouseClick("Left", 868, 143)
        Send($sID)
    Next

Even better, use the AutoIt Window Info Tool (in the same directory where you installed AutoIt) and hover over that box. If it returns information about the Control ID of the box, you can use ControlSend, which is a whole lot more reliable than a combination of MouseClick and Send.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 , Thanks a lot.

The code is working fine now and used Control-click for more robust code. 

Now I should tune the code in a better way. I'm posting my code below, kindly let me know if there is any scope of tuning it even better. Your Expertise can really help my code to become more robust. 

 

;App Live view tab and converting log file
WinActivate ("Connectivity.TestToolGui")
Sleep(250)
Send("{RIGHT 3}") ; Moving to Live View Tab
Sleep (1000)
Send("{TAB}")
Sleep(600)
Send("{ENTER}")
Sleep(1000)
Send("yo.nxc") ;Entering .nxc files "***modify it to control send***"
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
ControlClick("Connectivity.TestToolGui","","[CLASS:Edit; INSTANCE:15]") ; Entering center ID
Send ("900915")
Send ("{TAB}")
Sleep (500)
Send("{ENTER}")

Sleep (40000) ;Time given for converting .nxc into log file

;Portal Live View settings and launching Sessions

ControlClick("Connectivity.TestToolGui","","[CLASS:Edit; INSTANCE:13]") ; Entering center ID
Send ("900915")
Send("{TAB}")
Send("nurse15adm@nxstage.com") ; Entering nurse ID
Send("{TAB}")
Sleep(1000)
ControlClick("Connectivity.TestToolGui","","[CLASS:Edit; INSTANCE:14]") ; Entering server
Send ("NxDev06")
Sleep(500)
ControlClick("Connectivity.TestToolGui","","[CLASS:WindowsForms10.BUTTON.app.0.30495d1_r6_ad1; INSTANCE:67]"); launch session button
Sleep(3000)

; Live View Session New Tab

WinActivate("Live View Session")

    Local $aIDs = FileReadToArray("C:\Users\CS-NS6\Desktop\Automation\sample.csv") ; Read the current csv file into an array using the filepath."Enter csv file location"

    For $sID In $aIDs
        WinActivate("Live View Session") ;Live View session tab activate
        Sleep(3000)
        ControlClick("Live View Session for Patients in Center","","[CLASS:Edit; INSTANCE:2]") ; Entering Patient Id
        Sleep(3000)
        Send($sID)
        Sleep(5000)

        ControlClick("Live View Session for Patients in Center","","[CLASS:WindowsForms10.BUTTON.app.0.30495d1_r6_ad1; INSTANCE:13]") ; Login as Nurse
        Sleep(15000) ; More time for login

        ControlClick("Live View Session for Patients in Center","","[CLASS:WindowsForms10.BUTTON.app.0.30495d1_r6_ad1; INSTANCE:1]") ;Pressing Start Session Button
        Sleep(5000) ; To Start Session

        WinActivate("Connectivity.TestToolGui")
        Sleep(1000)

        ;ControlClick("Connectivity.TestToolGui","","[CLASS:WindowsForms10.BUTTON.app.0.30495d1_r6_ad1; INSTANCE:67]"); launch session button
        Send("{ENTER}")

        Sleep(1200)

    Next

 

 

Link to comment
Share on other sites

  • 4 weeks later...

Hello,

I have developed a GUI, where each button calls each function. In that GUI, there is a button named exit, which supposedly should terminate the execution of any current function running and should close the application (Desktop application). But, when I'm clicking on this button it is triggering only when the running function execution is completed.  Kindly Help me..! I'm working on this same code above. 

Is there any possibility to write a function which halts any current function and triggers the new function?

 

 

 

Edited by shivacharla
Link to comment
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
 Share

  • Recently Browsing   0 members

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