Danp2 Posted February 13, 2020 Author Share Posted February 13, 2020 Glad you were able to get it going. FWIW, you generally want to avoid using the Send function when interacting with a browser. You should be able to use the one of the existing _WD functions to trigger the page's submission. It's difficult to know which method will work without more details (website/HTML involved). P.S. I haven't tested this, but you may want to try appending the Enter keystroke to your password, ie -- _WD_ElementAction($sSession, $sElementp, 'value', $Password & @CR) PPS. Please read this to learn the proper way to post code on the forum Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
P00PDOG Posted February 13, 2020 Share Posted February 13, 2020 (edited) Danp2, thanks for the advice, I tried the @CR macro with the password line and also tried to sleep for a second and send it by itself but neither worked. I'm guessing that there is a way to click the "login" button. Can the element button be clicked by using either element id or name? I just don't know which function would do that . My issue was that the username and password go in super fast and then when I go to send the "ENTER" command I have to sleep for at least a second or it doesn't take. P.S. you are right... I knew about that code button but completely forgot about it, I will make sure to use it in the future. Cheers! Edited February 13, 2020 by P00PDOG Link to comment Share on other sites More sharing options...
Danp2 Posted February 13, 2020 Author Share Posted February 13, 2020 To click on the button, you have to -- Find it with _WD_FindElement Click on it with _WD_ElementAction (use 'click' instead of 'value' for $sCommand) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
P00PDOG Posted February 13, 2020 Share Posted February 13, 2020 danp2, well disregard my post again, i used the wrong macro, @CRFL worked like a charm, thank you. I am left trying to figure one last thing out. Do you know how to disable the password manager in chrome using the capabilities line? I would rather not have to specify a mandatory profile if I can help it. I researched the arguments of the chrome driver but there is nothing in there that I could find. Link to comment Share on other sites More sharing options...
Danp2 Posted February 13, 2020 Author Share Posted February 13, 2020 Search the forum for the term "credentials_enable_service" Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
P00PDOG Posted February 13, 2020 Share Posted February 13, 2020 Yup found it. Works great. I had to remove the ending brace and add it to the end of the line to make it work. Weird thing is when I added the "prefs" the "args stopped working. not a big deal really I got everything else working great. See below for anyone else looking for the answer... $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, "prefs": {"credentials_enable_service": false, "args": ["--window-size=1600,960"] }}}}}' Anyway thanks for all the help, really appreciated. Link to comment Share on other sites More sharing options...
P00PDOG Posted February 14, 2020 Share Posted February 14, 2020 The above mistakenly had the arguments in the wrong position, the above works except for the "args" statement. This did the trick, now "args" work too. $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, "args": ["--window-size=1280,960"], "prefs": {"credentials_enable_service": false }}}}}' Link to comment Share on other sites More sharing options...
abodilsen Posted February 16, 2020 Share Posted February 16, 2020 Hi, I have followed this video to make a test script that will search. https://finance.yahoo.com/ #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "http://finance.yahoo.com") _ChromeSetInputValueById( $sSession, 'yfin-usr-qry', 'Pandora') _WD_Shutdown() Func SetupChrome() _WD_Option( 'Driver', 'chromedriver.exe' ) _WD_Option( 'Port', 9515 ) _WD_Option( 'DriverParams', '--logpath="' & @ScriptDir & '\chrome.log"') ;$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":[' & """ ;$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}}' $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["user-data-dir=userData"] } }}}' EndFunc Func _ChromeSetInputValueById( $sSession, $Id, $Value) $sButton = _WD_FindElement( $sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']'" ) _WD_ElementAction( $sSession, $sButton, 'value', $Value) EndFunc I get this error message _WD_CreateSession ==> Webdriver Exception: invalid argument: unrecognized capability: chromeOptions Do we have one place to read up on how to contruct the $sDesiredCapabilities string ? thanks Link to comment Share on other sites More sharing options...
water Posted February 16, 2020 Share Posted February 16, 2020 (edited) When you open the WebDriver wiki you will find the "Reference" section at the end. Double post. Edited February 16, 2020 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted February 16, 2020 Share Posted February 16, 2020 When you open the WebDriver wiki you will find the "Reference" section at the end. Select the Chrome link and you will find what you need My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Danp2 Posted February 17, 2020 Author Share Posted February 17, 2020 You can also look in wd_demo for the correct syntax. Hint: They changed it a while back from "chromeOptions" to "goog:chromeOptions" Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
moxasya Posted February 19, 2020 Share Posted February 19, 2020 (edited) Hi dan.. im try both this and same error WD_FindElement or WD_ElementAction ? thanks in advance dan.. //first code $ChooseBtn = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='ContentPlaceHolder1_myFile']") _WD_ElementAction($sSession, $ChooseBtn, 'click') //second code $ChooseBtn = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='ContentPlaceHolder1_myFile']") _WD_ElementAction($sSession, $ChooseBtn, 'click') ERROR CODE __WD_Post: URL=HTTP://127.0.0.1:9515/session/2458b619fe4077fdb5fa7517c3b41ce6/element; $sData={"using":"xpath","value":"//*[@id='ContentPlaceHolder1_myFile']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"5751e49c-6972-4f50-ae6b-efaca5823cf9"}} _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"5751e49c-6972-4f50-ae6b-efaca5823cf9"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/2458b619fe4077fdb5fa7517c3b41ce6/element/5751e49c-6972-4f50-ae6b-efaca5823cf9/click; $sData={"id":"5751e49c-6972-4f50-ae6b-efaca5823cf9"} __WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument\n (Session info: chrome=80.0.3987.106)","stacktrace":"Backtrace:\n\tOrdinal0 [0x011A0C83+1707139]\n\tOrdinal0 [0x011068F1+1075441]\n\tOrdinal0 [0x0107DE72+515698]\n\tOrdinal0 [0x01013F8F+81807]\n\tOrdinal0 [0x01029E9D+171677]\n\tOrdinal0 [0x01013916+80150]\n\tOrdinal0 [0x0102A0E1+172257]\n\tOrdinal0 [0x010330F4+209140]\n\tOrdinal0 [0x01029D4B+171339]\n\tOrdinal0 [0x01011D4A+73034]\n\tOrdinal0 [0x01012DC0+77248]\n\tOrdinal0 [0x01012D59+77145]\n\tOrdinal0 [0x0111BB67+1162087]\n\tGetHandleVerifier [0x0123A966+508998]\n\tGetHandleVerifier [0x0123A6A4+508292]\n\tGetHandleVerifier [0x0124F7B7+594583]\n\tGetHandleVerifier [0x0123B1D6+511158]\n\tOrdinal0 [0x0111402C+1130540]\n\tOrdinal0 [0x0111D4CB+1168587]\n\tOrdinal0 [0x0111D633+1168947]\n\tOrdinal0 [0x01135B35+1268533]\n\tBaseThreadInitThunk [0x74E70419+25]\n\tRtlGetAppContainerNamedObjectPath [0x7710662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x771065FD+189]\n"}} _WD_ElementAction: {"value":{"error":"invalid argument","message":"invalid argument\n (Session info: chrome=80.0.3987.... _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"invalid argument","message":"invalid argument\n (Session info: chrome=80.0.3987.106)","stacktrace":"Backtrace:\n\tOrdinal0 [0x011A0C83+1707139]\n\tOrdinal0 [0x011068F1+1075441]\n\tOrdinal0 [0x0107DE72+515698]\n\tOrdinal0 [0x01013F8F+81807]\n\tOrdinal0 [0x01029E9D+171677]\n\tOrdinal0 [0x01013916+80150]\n\tOrdinal0 [0x0102A0E1+172257]\n\tOrdinal0 [0x010330F4+209140]\n\tOrdinal0 [0x01029D4B+171339]\n\tOrdinal0 [0x01011D4A+73034]\n\tOrdinal0 [0x01012DC0+77248]\n\tOrdinal0 [0x01012D59+77145]\n\tOrdinal0 [0x0111BB67+1162087]\n\tGetHandleVerifier [0x0123A966+508998]\n\tGetHandleVerifier [0x0123A6A4+508292]\n\tGetHandleVerifier [0x0124F7B7+594583]\n\tGetHandleVerifier [0x0123B1D6+511158]\n\tOrdinal0 [0x0111402C+1130540]\n\tOrdinal0 [0x0111D4CB+1168587]\n\tOrdinal0 [0x0111D633+1168947]\n\tOrdinal0 [0x01135B35+1268533]\n\tBaseThreadInitThunk [0x74E70419+25]\n\tRtlGetAppContainerNamedObjectPath [0x7710662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x771065FD+189]\n"}} Edited February 19, 2020 by moxasya Link to comment Share on other sites More sharing options...
Danp2 Posted February 19, 2020 Author Share Posted February 19, 2020 @moxasya This is expected behavior per the W3C specs (see item 4). Have you tried using _WD_SelectFiles instead? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
neypro Posted February 27, 2020 Share Posted February 27, 2020 hello, You can help me, I use chrome selenium to login but it doesn't show the profile I created :(( #include "wd_core.au3" #include "wd_helper.au3" #include "EncodeHtmlEntities.au3" #RequireAdmin Local $sDesiredCapabilities,$sSession,$Sv_Data,$File_Error,$time_delay $user_profile='C:\\Users\\24h\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 1' _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":["user-data-dir='&$user_profile&'"] }}}}' _WD_Startup() Sleep(7000) $sSession=_WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession,'https://www.google.com') _WD_LoadWait($sSession) Link to comment Share on other sites More sharing options...
neypro Posted February 27, 2020 Share Posted February 27, 2020 or is there any way to help me log into google on chrome selenium :(( Link to comment Share on other sites More sharing options...
Danp2 Posted February 27, 2020 Author Share Posted February 27, 2020 @neypro Answered in the other thread. Please don't cross-post. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
neypro Posted February 27, 2020 Share Posted February 27, 2020 Sorry, I was in a hurry. I have solved my problem. thank you very much Link to comment Share on other sites More sharing options...
VodkaDiva Posted February 29, 2020 Share Posted February 29, 2020 (edited) Hi everybody . i need help about select facebook tab. image 1 : e need click "Currency" to change money type to " US dollar" and i can click it . but when to chose "US dollar " i search f12 don't have any thing about this tab . and i use check element and use this code. expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" #include <GUIConstantsEx.au3> Local $sDesiredCapabilities, $iIndex, $sSession Local $nMsg, $lProcess = False Main() Func Main() Setupopen() $sSession = _WD_CreateSession($sDesiredCapabilities) ;_WD_Navigate($sSession, "http://facebook.com") ;_WD_Action($sSession,"refresh") _WD_Navigate($sSession, "https://business.facebook.com/ads/manager/account_settings/information") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='email']") _WD_ElementAction($sSession, $sElement, 'value', "100046163019287") Sleep(500) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='pass']") _WD_ElementAction($sSession, $sElement, 'value', "291203") Sleep(500) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@id='loginbutton']") _WD_ElementAction($sSession, $sButton, 'click') Sleep(10500) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@rel='dialog']") _WD_ElementAction($sSession, $sButton, 'click') Sleep(10500) ;Code need fix here .thanks you ________________________________________________________________ $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='_4o_3 _3-99']") _WD_ElementAction($sSession, $sButton, 'click') Sleep(2000) _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='_4o_3 _3-99']","US Dollars (USD)") ; Test click "us doolar" 1 Sleep(2000) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='js_9o']/div[1]/div[1]/ul[1]/li[51]") ; Test click "us doolar" 2 _WD_ElementAction($sSession, $sButton, 'click') Sleep(2000) ;Code need fix here .thanks you ________________________________________________________________ $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[id='u_4k_8']") _WD_ElementAction($sSession, $sButton, 'click') EndFunc 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 }}}}' EndFunc Func Setupopen() ; Set debug level $_WD_DEBUG = "Full" ; Execute browser setup routine for user's browser selection Call(SetupChrome) _WD_Startup() If @error <> $_WD_ERROR_Success Then Exit -1 EndIf EndFunc Some one can help me? thanks you . Edited February 29, 2020 by VodkaDiva xxxxxxxxxxx Link to comment Share on other sites More sharing options...
mLipok Posted February 29, 2020 Share Posted February 29, 2020 First read: and this: https://www.autoitscript.com/wiki/Forum_FAQ#How_can_I_post_.22code.22_on_the_forum_.3F also:https://www.autoitscript.com/wiki/Forum_FAQ#How_can_I_edit_my_post_on_the_forum_.3F so I propose you to edit your post because the code you posted is not posted well (is not formated). Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
VodkaDiva Posted February 29, 2020 Share Posted February 29, 2020 Thanks you ! first time i post on forum . thanks you xxxxxxxxxxx Link to comment Share on other sites More sharing options...
Recommended Posts