matecki Posted June 1, 2020 Share Posted June 1, 2020 At the beggining i must say that i am begginer in Autoit. I am trying to create autologin script and everything works fine for one user. But the problem is i have 10 user to test. And i would like to login this users one by one. How can i do it? #include "wd_core.au3" #include "wd_helper.au3" #include "Misc.au3" #include <File.au3> Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "http://example") _ChromeSetInputValueById($sSession,'Uid','abc')//login _ChromeSetInputValueById($sSession,'Pwd','xyz')//password _ChromeSetInputValueById($sSession,'ConnMode32','Auth') $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&3054&"']") _WD_ElementAction($sSession,$sButton,'click') _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":[' & """start-maximized""," & " ""disable-infobars""" & "" & '] }}}}' EndFunc ;==>SetupChrome Func _ChromeSetInputValueById($sSession,$Id,$Value) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']") _WD_ElementAction($sSession,$sButton,'value', $Value) EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2020 Moderators Share Posted June 1, 2020 matecki, Welcome to the AutoIt forums. Just why do you need to autologon as 10 different users? M23 P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out. 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
matecki Posted June 1, 2020 Author Share Posted June 1, 2020 I must test behaviours of particular users in website (errors, messageBox etc). Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2020 Moderators Share Posted June 1, 2020 matecki, Why do you need to have different users to do this? Surely you can do the tests as a single user? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
matecki Posted June 1, 2020 Author Share Posted June 1, 2020 4 minutes ago, Melba23 said: matecki, Why do you need to have different users to do this? Surely you can do the tests as a single user? M23 I got the task to test behavior of each user. So i must to autologin one by one . Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2020 Moderators Share Posted June 1, 2020 matecki, I still do not understand why you need to log on as separate users. What makes each user so different? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
matecki Posted June 2, 2020 Author Share Posted June 2, 2020 15 hours ago, Melba23 said: matecki, I still do not understand why you need to log on as separate users. What makes each user so different? M23 Some users have different privilege, so they shouldn't go to specific pages. Link to comment Share on other sites More sharing options...
argumentum Posted June 2, 2020 Share Posted June 2, 2020 --profile-directory="Profile 1" Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 2, 2020 Moderators Share Posted June 2, 2020 (edited) argumentum, As I have yet to clear the thread, why are you barging in despite my asking earlier for people to stay out? However, as I am just about to permit it, we will say no more this time. matecki, Good enough - please take argumentum's advice. M23 Edited June 2, 2020 by Melba23 Typo argumentum 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Danp2 Posted June 2, 2020 Share Posted June 2, 2020 If the logins are occurring sequentially, then I don't see why you need to use multiple profiles. Just do one of the following -- Logout from the website before continuing with the next user id Call _WD_Startup() again, which will close the existing webdriver instance and launch a new one (thus giving you a new profile to work from). You would then need to start a new session with _WD_CreateSession matecki 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
matecki Posted June 2, 2020 Author Share Posted June 2, 2020 9 minutes ago, Danp2 said: If the logins are occurring sequentially, then I don't see why you need to use multiple profiles. Just do one of the following -- Logout from the website before continuing with the next user id Call _WD_Startup() again, which will close the existing webdriver instance and launch a new one (thus giving you a new profile to work from). You would then need to start a new session with _WD_CreateSession Thank you:) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now