Harutyun Posted September 2, 2020 Posted September 2, 2020 (edited) Hello everyone, I'm green hand) I can't find the solution why attached script doesn't work. _ChromeObjSetValueByName want to set value by name, but not executing these commands expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" #Include <Array.au3> #Include <Chrome.au3> Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[' & """start-maximized""," & " ""disable-infobars""" & "" & '] }}}}' EndFunc Func _ChromeSetInputValueById($sSession,$Id,$Value) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']") _WD_ElementAction($sSession,$sButton,'value', $Value) EndFunc Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.autoitscript.com/forum/") _WD_Window($sSession, "maximize", "") Sleep(500) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='elUserSignIn']") _WD_ElementAction($sSession, $sElement, "click") Sleep(500) $Username = "testlogin" $Password = "testpassword" _ChromeObjSetValueByName("auth",$Username) Sleep(700) _ChromeObjSetValueByName("password",$Password) Sleep(500) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='elSignIn_submit']") _WD_ElementAction($sSession, $sElement, "click") Edited September 2, 2020 by Harutyun
Moderators Melba23 Posted September 2, 2020 Moderators Posted September 2, 2020 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team 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
Harutyun Posted September 2, 2020 Author Posted September 2, 2020 16 minutes ago, Melba23 said: Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Moderation Team sorry, did you move already
Harutyun Posted September 2, 2020 Author Posted September 2, 2020 28 minutes ago, Harutyun said: sorry, did you move already I see, thanks
Zedna Posted September 2, 2020 Posted September 2, 2020 Use "Code" tags instead of inserting screenshot images of your code. Resources UDF ResourcesEx UDF AutoIt Forum Search
Musashi Posted September 2, 2020 Posted September 2, 2020 @Harutyun ==> how-to-post-code-on-the-forum To post code on the forum, please use the following procedure: Click the Code button on the editor toolbar. Select the code type (for most people this will either be AutoIt or Plain Text - AutoIt is the default) Paste or type your code and then click OK. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Danp2 Posted September 2, 2020 Posted September 2, 2020 Do you have the full Scite editor installed? If not you can download from this page. I asked the above because the issue I see is that you are trying to execute a non-existent function (_ChromeObjSetValueByName) and Scite would have quickly pointed that out for you when you attempted to run the script. FWIW, I do recommend using the function _ChromeSetInputValueById as written because it doesn't perform any error checking. You might want to take a look at using _WD_GetElementById, _WD_GetElementByName and _WD_SetElementValue, which were recently added to the UDF as "helper" functions. Latest Webdriver UDF Release Webdriver Wiki FAQs
Harutyun Posted September 2, 2020 Author Posted September 2, 2020 16 minutes ago, Danp2 said: Do you have the full Scite editor installed? If not you can download from this page. yes, I have downloaded
Developers Jos Posted September 2, 2020 Developers Posted September 2, 2020 Great, so what does it tell you when you run the script? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Harutyun Posted September 2, 2020 Author Posted September 2, 2020 57 minutes ago, Danp2 said: Scite would have quickly pointed that out for you when you attempted to run the script there is no any error , after run all is done, only part of _ChromeObjSetValueByName isn't working
Danp2 Posted September 2, 2020 Posted September 2, 2020 @Harutyun The code you posted doesn't contain a function named _ChromeObjSetValueByName, so I don't see how the code can even execute. 🤨 Please run the code using Scite and then post the complete results from the Scite output panel. Latest Webdriver UDF Release Webdriver Wiki FAQs
Harutyun Posted September 2, 2020 Author Posted September 2, 2020 2 minutes ago, Danp2 said: @Harutyun The code you posted doesn't contain a function named _ChromeObjSetValueByName, so I don't see how the code can even execute. 🤨 Please run the code using Scite and then post the complete results from the Scite output panel. expandcollapse popup>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Harutyun Harutyunyan\AppData\Local\AutoIt v3\test\fullScreen.au3" /UserParams +>17:17:45 Starting AutoIt3Wrapper (19.1127.1402.0} from:SciTE.exe (4.2.0.0) Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Harutyun Harutyunyan\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Harutyun Harutyunyan\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Harutyun Harutyunyan\AppData\Local\AutoIt v3\test\fullScreen.au3 +>17:17:45 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Harutyun Harutyunyan\AppData\Local\AutoIt v3\test\fullScreen.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. _WD_IsLatestRelease: False _WD_IsLatestRelease ==> Success _WDStartup: OS: WIN_10 WIN32_NT 18363 _WDStartup: AutoIt: 3.3.14.5 _WDStartup: WD.au3: 0.3.0.6 (Update available) _WDStartup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) _WDStartup: Driver: chromedriver.exe _WDStartup: Params: --log-path="C:\Users\Harutyun Harutyunyan\AppData\Local\AutoIt v3\test\chrome.log" _WDStartup: Port: 9515 __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}} __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.... _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.4183.83","chrome":{"chromedriverVersion":"84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310})","userDataDir":"C:\\Users\\HARUTY~1\\AppData\\Local\\Temp\\scoped_dir22524_419438348"},"goog:chromeOptions":{"debuggerAddress":"localhost:57350"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"9e49fd4c61d82327fc5a5b4771027859"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/9e49fd4c61d82327fc5a5b4771027859/url; $sData={"url":"https://www.autoitscript.com/forum/"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/9e49fd4c61d82327fc5a5b4771027859/window/maximize; $sData={} __WD_Post: StatusCode=200; ResponseText={"value":{"height":1056,"width":1936,"x":-8,"y":-8}}... _WD_Window: {"value":{"height":1056,"width":1936,"x":-8,"y":-8}}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/9e49fd4c61d82327fc5a5b4771027859/element; $sData={"using":"xpath","value":"//*[@id='elUserSignIn']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"ea484aa4-98e2-415b-a923-7d83c1944c4a"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"ea484aa4-98e2-415b-a923-7d83c1944c4a"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/9e49fd4c61d82327fc5a5b4771027859/element/ea484aa4-98e2-415b-a923-7d83c1944c4a/click; $sData={"id":"ea484aa4-98e2-415b-a923-7d83c1944c4a"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/9e49fd4c61d82327fc5a5b4771027859/element; $sData={"using":"xpath","value":"//*[@id='elSignIn_submit']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"adf20a30-5ef5-44f3-872c-56c1ec1f466f"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"adf20a30-5ef5-44f3-872c-56c1ec1f466f"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/9e49fd4c61d82327fc5a5b4771027859/element/adf20a30-5ef5-44f3-872c-56c1ec1f466f/click; $sData={"id":"adf20a30-5ef5-44f3-872c-56c1ec1f466f"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... +>17:18:09 AutoIt3.exe ended.rc:0 +>17:18:09 AutoIt3Wrapper Finished. >Exit code: 0 Time: 24.71 this is the result
Danp2 Posted September 2, 2020 Posted September 2, 2020 @Harutyun Please follow the suggestions and update to the latest versions of the WinHTTP and Webdriver UDFs. Quote #Include <Chrome.au3> So, you are trying to use both the Webdriver UDF and the Chome UDF?! Don't think you will succeed with that. 🙄 Latest Webdriver UDF Release Webdriver Wiki FAQs
Harutyun Posted September 2, 2020 Author Posted September 2, 2020 @Danp2 ok, I will update , thank you very much in this case which is better use Webdriver UDF instead of Chrome?
Danp2 Posted September 2, 2020 Posted September 2, 2020 There isn't a "better" option. They are two different methods to control a browser. You should pick the one that works best for your task. Latest Webdriver UDF Release Webdriver Wiki FAQs
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