Danp2 Posted November 26, 2018 Author Share Posted November 26, 2018 Two possibilities come to mind - 1. Any frames in use on the page? If so, then you likely need to switch to the correct frame before the element can be located 2. It looks like the colon is being removed from the element name. I would need to research this to see where this is occurring Aelc 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 8 minutes ago, Danp2 said: Two possibilities come to mind - 1. Any frames in use on the page? If so, then you likely need to switch to the correct frame before the element can be located 2. It looks like the colon is being removed from the element name. I would need to research this to see where this is occurring $a = _WD_Navigate($sSession, '$url') Sleep (20000) $sElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='j_idt12email']") i just renamed the element in the sleep time manually in chrome to remove the colon -> no error can i handle it differently for now? maybe with other search strategy? why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Danp2 Posted November 26, 2018 Author Share Posted November 26, 2018 @Aelc What website are you trying to access? I tested with https://transporteg.com/ and it works as expected with both Chrome and Firefox. Also, what version of ChromeDriver are you using? Aelc 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 2 minutes ago, Danp2 said: @Aelc What website are you trying to access? I tested with https://transporteg.com/ and it works as expected with both Chrome and Firefox. https://connect3.froeling.com/FroelingGUI/pages/public/login.xhtml?faces-redirect=true&lb=1543261372812 its for checking heating systems. 3 minutes ago, Danp2 said: Also, what version of ChromeDriver are you using? "chromedriverVersion": "71.0.3578.33 (269aa0e3f0db08097f0fe231c7e6be200b6939f7)" why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Danp2 Posted November 26, 2018 Author Share Posted November 26, 2018 6 minutes ago, Aelc said: "chromedriverVersion": "71.0.3578.33 (269aa0e3f0db08097f0fe231c7e6be200b6939f7)" Where are you getting that information? And where did you download that driver? AFAIK, the latest driver version is 2.44.609538. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 i think i got it. the website change the email name. it actually works sometimes.. so i have to try to find the different names when he fails. thank you so much for help why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 Just now, Danp2 said: Where are you getting that information? And where did you download that driver? AFAIK, the latest driver version is 2.44.609538. comes from the chrome.txt it created where do i find the right version nr? why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Danp2 Posted November 26, 2018 Author Share Posted November 26, 2018 2 minutes ago, Aelc said: comes from the chrome.txt it created OIC. Mine gives the following -- Quote "chromedriverVersion": "2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90)" You can download the latest versions here. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 2 minutes ago, Danp2 said: OIC. Mine gives the following -- You can download the latest versions here. yea was my bad... cause it didnt worked before i tried this one https://chromedriver.storage.googleapis.com/index.html?path=71.0.3578.33/ cause it was released 02.11.18 i replaced it but that wasnt the problem actually why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Danp2 Posted November 26, 2018 Author Share Posted November 26, 2018 5 minutes ago, Aelc said: i replaced it but that wasnt the problem actually So what's happening now? Is the colon still disappearing? FWIW, It's working properly on my end. Anything unusual about your setup? Running non-English version of Windows, etc? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 7 minutes ago, Danp2 said: So what's happening now? Is the colon still disappearing? FWIW, It's working properly on my end. Anything unusual about your setup? Running non-English version of Windows, etc? all fine now. $sSession = _WD_CreateSession($sDesiredCapabilities) $a = _WD_Navigate($sSession, 'https://connect3.froeling.com/FroelingGUI/pages/public/login.xhtml?faces-redirect=true&lb=1543253960343') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='j_idt12:email']") If @error = $_WD_ERROR_NoMatch Then $sElements =_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='j_idt11:email']") If @error = $_WD_ERROR_NoMatch Then $sElements =_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='j_idt10:email']") EndIf EndIf _WD_ElementAction($sSession, $sElement, 'value', "abc xyz") that works for me. i just never saw that websites change element names before... Thank you! why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Aelc Posted November 26, 2018 Share Posted November 26, 2018 at least i dunno why the colon was removed but i started the script like 20 times and it works if it happens again i will tell u why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Deathdn Posted November 27, 2018 Share Posted November 27, 2018 Anyone know how to close current tab? Tks!! Link to comment Share on other sites More sharing options...
Danp2 Posted November 27, 2018 Author Share Posted November 27, 2018 Have you tried using _WD_Window with the Close action? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Deathdn Posted November 27, 2018 Share Posted November 27, 2018 Yeah, thank you. I thought this command will close window = browser Link to comment Share on other sites More sharing options...
Deathdn Posted November 27, 2018 Share Posted November 27, 2018 Can you close another tab without focus it ? Or we must focus this tab, close it and switch back to current tab? Link to comment Share on other sites More sharing options...
Danp2 Posted November 27, 2018 Author Share Posted November 27, 2018 I believe that you will need to switch to the tab, delete it, then restore focus to the current tab. Deathdn 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
truong2301 Posted November 28, 2018 Share Posted November 28, 2018 How to change user-agent bro Link to comment Share on other sites More sharing options...
Danp2 Posted November 28, 2018 Author Share Posted November 28, 2018 This isn't a forum where you can expect us to just regurgitate code for you. What have you tried? P.S. Who is this bro character you keep referring to? 😃 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jezyy Posted November 30, 2018 Share Posted November 30, 2018 Hello everybody This is my first post on this forum and I'd like to congratulate all contributors for the great job over the great UDF. Good job guys ! And now straight to the point. My code looks like this (UTF-8 encoded) : ; launching Chrome: _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path=' & @ScriptDir & '\chrome.log') Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}' _WD_Startup() $oChr = _WD_CreateSession($sDesiredCapabilities) $sStatus = _WD_Status() ; main script START ==================================================================== _WD_Navigate($oChr, "https://www.google.pl") $inp_search = _WD_FindElement($oChr, $_WD_LOCATOR_ByCSSSelector, "input[name='q']") $inpText = "AB\s=#CD" ; << this is text that is to be entered into input field (password like, so it can contain special characters: [",\,']) ConsoleWrite("!" & _WD_ElementAction($oChr, $inp_search, "value", $inpText) & @CRLF) ; << this code produces 'missing command parameters' result Local $sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $inp_search & '"}' ConsoleWrite("! JS Script Execution response: " & _WD_ExecuteScript($oChr, "return arguments[0].setAttribute('value', '" & StringReplace($inpText, "\", "\\\\") & "')", $sJsonElement) & @CRLF) ; << this code is ok, unless ' or " character is entered _WD_ElementAction($oChr, $inp_search, "clear") _WD_ElementAction($oChr, $inp_search, "value", "JEZYY") ; << just to be sure, that _WD_ElementAction works with standard alphabet ;) ; main script END ==================================================================== ; closing Chrome _WD_DeleteSession($oChr) _WD_Shutdown() Quote _WDStartup: OS: WIN_10 WIN32_NT 17134 _WDStartup: AutoIt: 3.3.14.5 _WDStartup: WD.au3: 0.1.0.15 _WDStartup: Driver: chromedriver.exe _WDStartup: Params: --log-path=D:\DEV\priv\AutoIT\WebDriver\chrome.log _WDStartup: Port: 9515 __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}} __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a)","userDataDir":"C:\\Users\\Mateusz\\AppData\\Local\\Temp\\scoped_dir76636_20205"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:49813"},"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unhandledPromptBehavior":"","version":"70.0.3538.110","webStorageEnabled":true},"sessionId":"50d636ee60cc22ce12a07e3f45bf0527"}} _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a)","userDataDir":"C:\\Users\\Mateusz\\AppData\\Local\\Temp\\scoped_dir76636_20205"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:49813"},"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unhandledPromptBehavior":"","version":"70.0.3538.110","webStorageEnabled":true},"sessionId":"50d636ee60cc22ce12a07e3f45bf0527"}} __WD_Get: URL=HTTP://127.0.0.1:9515/status __WD_Get: StatusCode=200; $sResponseText={"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Windows NT","version":"10.0.17134"}}} _WD_Status: {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Windows NT","version":"10.0.17134"}}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527/url; $sData={"url":"https://www.google.pl"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527/element; $sData={"using":"css selector","value":"input[name='q']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"8f2b0231-26ab-4b51-81ba-53fcdc5e34af"}} _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"8f2b0231-26ab-4b51-81ba-53fcdc5e34af"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527/element/8f2b0231-26ab-4b51-81ba-53fcdc5e34af/value; $sData={"id":"8f2b0231-26ab-4b51-81ba-53fcdc5e34af", "text":"AB\s=#CD", "value":["A","B","\","s","=","#","C","D"]} __WD_Post: StatusCode=400; ResponseText=missing command parameters _WD_ElementAction: missing command parameters!missing command parameters __WD_Post: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527/execute/sync; $sData={"script":"return arguments[0].setAttribute('value', 'AB\\\\s=#CD')", "args":[{"element-6066-11e4-a52e-4f735466cecf":"8f2b0231-26ab-4b51-81ba-53fcdc5e34af"}]} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ExecuteScript: {"value":null}! JS Script Execution response: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527/element/8f2b0231-26ab-4b51-81ba-53fcdc5e34af/clear; $sData={"id":"8f2b0231-26ab-4b51-81ba-53fcdc5e34af"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527/element/8f2b0231-26ab-4b51-81ba-53fcdc5e34af/value; $sData={"id":"8f2b0231-26ab-4b51-81ba-53fcdc5e34af", "text":"JEZYY", "value":["J","E","Z","Y","Y"]} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null} __WD_Delete: URL=HTTP://127.0.0.1:9515/session/50d636ee60cc22ce12a07e3f45bf0527 __WD_Delete: StatusCode=200; ResponseText={"value":null} _WD_DeleteSession: {"value":null} So, my question is : how could it be possible to enter the following values into input field - preferably without using JS via _WD_ExecuteScript : $inpText = "AB\s=#CD" (possible with JS) $inpText = "AB\s=#C'D" $inpText = "AB\s=#C""D" for point 2 I get following error (even after modyfing original string like "AB\\\\s=#C''D" or "AB\\\\s=#C\'D" : Quote __WD_Post: URL=HTTP://127.0.0.1:9515/session/8d8db7134154a37d1cc2fc6900aaa17d/execute/sync; $sData={"script":"return arguments[0].setAttribute('value', 'AB\\\\s=#C'D')", "args":[{"element-6066-11e4-a52e-4f735466cecf":"cdfbf0f6-8b43-4ee1-8c6d-3e5ab431990b"}]} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"Runtime.evaluate threw exceptionSyntaxErrormissing ) after argument list(Session infochrome=70.0.3538.110)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01343CF0+867568]\n\tOrdinal0 [0x012EDB7D+514941]\n\tOrdinal0 [0x012BB367+308071]\n\tOrdinal0 [0x012BFE9E+327326]\n\tOrdinal0 [0x012BCBAD+314285]\n\tOrdinal0 [0x012BC9E4+313828]\n\tOrdinal0 [0x012BCDC2+314818]\n\tOrdinal0 [0x012A3036+208950]\n\tOrdinal0 [0x0129AE8D+175757]\n\tOrdinal0 [0x012A278D+206733]\n\tOrdinal0 [0x0129AD2B+175403]\n\tOrdinal0 [0x01283740+79680]\n\tOrdinal0 [0x01284CFC+85244]\n\tOrdinal0 [0x01284C50+85072]\n\tOrdinal0 [0x0134E62A+910890]\n\tOrdinal0 [0x012F8993+559507]\n\tOrdinal0 [0x012F8BA3+560035]\n\tOrdinal0 [0x012F8C8C+560268]\n\tOrdinal0 [0x01351907+923911]\n\tOrdinal0 [0x012F87FF+559103]\n\tOrdinal0 [0x0130306E+602222]\n\tOrdinal0 [0x0130EA3B+649787]\n\tOrdinal0 [0x0130EBA5+650149]\n\tOrdinal0 [0x0130DDA5+646565]\n\tBaseThreadInitThunk [0x74728484+36]\n\tRtlValidSecurityDescriptor [0x7706302C+284]\n\tRtlValidSecurityDescriptor [0x77062FFA+234]\n"}} _WD_ExecuteScript: {"value":{"error":"unknown error","message":"Runtime.evaluate threw exceptionSyntaxErrormissing ) after argument list(Session infochrome=70.0.3538.110)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01343CF0+867568]\n\tOrdinal0 [0x012EDB7D+514941]\n\tOrdinal0 [0x012BB367+308071]\n\tOrdinal0 [0x012BFE9E+327326]\n\tOrdinal0 [0x012BCBAD+314285]\n\tOrdinal0 [0x012BC9E4+313828]\n\tOrdinal0 [0x012BCDC2+314818]\n\tOrdinal0 [0x012A3036+208950]\n\tOrdinal0 [0x0129AE8D+175757]\n\tOrdinal0 [0x012A278D+206733]\n\tOrdinal0 [0x0129AD2B+175403]\n\tOrdinal0 [0x01283740+79680]\n\tOrdinal0 [0x01284CFC+85244]\n\tOrdinal0 [0x01284C50+85072]\n\tOrdinal0 [0x0134E62A+910890]\n\tOrdinal0 [0x012F8993+559507]\n\tOrdinal0 [0x012F8BA3+560035]\n\tOrdinal0 [0x012F8C8C+560268]\n\tOrdinal0 [0x01351907+923911]\n\tOrdinal0 [0x012F87FF+559103]\n\tOrdinal0 [0x0130306E+602222]\n\tOrdinal0 [0x0130EA3B+649787]\n\tOrdinal0 [0x0130EBA5+650149]\n\tOrdinal0 [0x0130DDA5+646565]\n\tBaseThreadInitThunk [0x74728484+36]\n\tRtlValidSecurityDescriptor [0x7706302C+284]\n\tRtlValidSecurityDescriptor [0x77062FFA+234]\n"}} point 3 result with: Quote __WD_Post: URL=HTTP://127.0.0.1:9515/session/ee766c077309b746e165cace74d27ced/execute/sync; $sData={"script":"return arguments[0].setAttribute('value', 'AB\\\\s=#C"D')", "args":[{"element-6066-11e4-a52e-4f735466cecf":"db3e025c-199b-4b00-98f3-8c95f4a22f32"}]} __WD_Post: StatusCode=400; ResponseText=missing command parameters _WD_ExecuteScript: missing command parameters Link to comment Share on other sites More sharing options...
Recommended Posts