Danp2 Posted September 8, 2018 Author Share Posted September 8, 2018 @omarjr16 Please post a fully runnable version of the script so that we can perform testing on our end. Otherwise, we can only guess at why you are encountering this issue. P.S. I know that the Chrome web driver has some issues. You may want to try testing with Firefox to see if the issue remains. You could also confirm the web driver functionality by running the function in wd_demo. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
omarjr16 Posted September 8, 2018 Share Posted September 8, 2018 I tried firefox and its work perfectly  Switching to a frame work fine in ChromeDriver 2.29 and below. but dont work with ChromeDriver 2.35. https://github.com/SeleniumHQ/selenium/issues/5401 i will try older version also i need to download older version of chrome (v62 or below) and thats sad bc v69 is great Link to comment Share on other sites More sharing options...
Danp2 Posted September 8, 2018 Author Share Posted September 8, 2018 Right. I had just confirmed that there is already an outstanding issue on this (https://github.com/Danp2/WebDriver/issues/21) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
omarjr16 Posted September 8, 2018 Share Posted September 8, 2018 (edited) i want to run 2 sessions in the same time but i got this error when it was opening the second session also its work fine using chromedriver but dont work with geckodriver... geckodriver dont support multi-sessions?  1536439370982 webdriver::server DEBUG <- 500 Internal Server Error {"value":{"error":"session not created","message":"Session is already started","stacktrace":""}} $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) _WD_Startup() $sSession1 = _WD_CreateSession($sDesiredCapabilities) $sSession2 = _WD_CreateSession($sDesiredCapabilities)  Edited September 8, 2018 by omarjr16 Link to comment Share on other sites More sharing options...
Danp2 Posted September 8, 2018 Author Share Posted September 8, 2018 I don't believe that the W3C specs require support for multiple sessions. It should be possible to launch multiple instances of geckodriver using a different port for each one. However, the Webdriver UDF hasn't been designed to support this scenario so YMMV. I am able to communicate / control multiple Firefox tabs using a single instance of geckodriver. Perhaps you could provide a detailed description of what you are attempting to accomplish and why you don't think you can do that with a single instance of geckodriver. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
omarjr16 Posted September 9, 2018 Share Posted September 9, 2018 (edited) i thought that opening multiple sessions will make it faster  and i prove again that im stupid  also i noticed that its possible to open multi sessions only if everysession use diffrent data then the other sessions (google chrome) thank you anyways for helping me i dont need multiple sessions anymore ... this is my last question how to get style value (display: none; left: 780px; top: -682px;) <div id="myid" style="display: none; left: 780px; top: -682px;"> i tried this but didnt work :/ $element = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, "//div[@id='myid']") $style = _WD_ElementAction($sSession,$id ,'attribute', 'style' ) Edited September 9, 2018 by omarjr16 Link to comment Share on other sites More sharing options...
Danp2 Posted September 9, 2018 Author Share Posted September 9, 2018 "Didn't work" isn't an adequate description of what occurred. A few suggestions for you -- When asking for help, post a snippet of code that someone else can run without further modification. Show the results from the Scite output panel or at least give enough details so that we aren't guessing at what didn't work as expected. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
PoojaKrishna Posted September 10, 2018 Share Posted September 10, 2018 (edited) Hi Friends, I'm trying to add a new cookie on Chrome using _WD_Cookies($sSession, $sCommand, $sOption = '') and getting an error in response. The other commands get, getall and delete are working perfect with Chrome. I know the status of add cookie command is only partially complete on the status. but still like to check with the experts here :-) When I try to set a new cookie, I am getting the error. {"value":{"error":"unknown error","message":"missing 'cookie'(Session infochrome=68.0.3440.106)","stacktrace":"Backtrace:\n\tOrdinal0 [0x0045DF70+778096]\n\tOrdinal0 [0x0040B42D+439341]\n\tOrdinal0 [0x003E807F+295039]\n\tOrdinal0 [0x003D3820+210976]\n\tOrdinal0 [0x003C8349+164681]\n\tOrdinal0 [0x003CF96B+194923]\n\tOrdinal0 [0x003C824F+164431]\n\tOrdinal0 [0x003B1B45+72517]\n\tOrdinal0 [0x003B2F2A+77610]\n\tOrdinal0 [0x003B2ECC+77516]\n\tGetHandleVerifier [0x004F9936+3478]\n\tOrdinal0 [0x004688C3+821443]\n\tOrdinal0 [0x00417066+487526]\n\tOrdinal0 [0x00417393+488339]\n\tOrdinal0 [0x004174A3+488611]\n\tOrdinal0 [0x0046AA67+830055]\n\tOrdinal0 [0x00416DAF+486831]\n\tOrdinal0 [0x004213FE+529406]\n\tOrdinal0 [0x0042C57B+574843]\n\tOrdinal0 [0x0042C6CD+575181]\n\tOrdinal0 [0x0042B92B+571691]\n\tBaseThreadInitThunk [0x75CD8484+36]\n\tRtlValidSecurityDescriptor [0x77AF2FEA+282]\n\tRtlValidSecurityDescriptor [0x77AF2FBA+234]\n"}} Is this because the add command is not yet done for Chrome or any mistake in my program. Please help. #include "wd_core.au3" #RequireAdmin _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') _WD_Startup() $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}' Global $sSession = _WD_CreateSession($sDesiredCapabilities) If @Error Then msgbox(0,"Error", "Failed to create session." & @CRLF & "Select [Ok] to Exit") exit EndIf _WD_Navigate($sSession, "https://www.gmail.com") ;Navigate to URL $sName = "Testname" $svalue ="TestValue" $sCookie = "{""name"":""" & $sName & """,""value"":""" & $svalue & """}" $sRes = _WD_Cookies($sSession, 'add',$sCookie) Msgbox(0,"Result of Add cookie", $sRes) $sRes = _WD_Cookies($sSession, 'getall') msgbox(0,"Result of getall", $sRes) _WD_DeleteSession($sSession) _WD_Shutdown()  Edited September 11, 2018 by PoojaKrishna Corrected the code. _WD_Option calls need to come before _WD_Startup. Link to comment Share on other sites More sharing options...
Danp2 Posted September 10, 2018 Author Share Posted September 10, 2018 @PoojaKrishna Your code isn't runnable as posted (the _WD_Option calls need to come before _WD_Startup). The Chrome implementation for Add Cookies is partially implemented per their own documentation. There's an open issue, which you can read about here. I haven't verified the Add Cookie functionality, so it's possible that the UDF is wrong. It's also possible that your $sCookie is missing needed data. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted September 10, 2018 Author Share Posted September 10, 2018 Change this -- $sCookie = "{""name"":""" & $sName & """,""value"":""" & $svalue & """}" to this -- $sCookie = '{"cookie": {"name":"' & $sName & '","value":"' & $svalue & '"}}' and it should work correctly. PoojaKrishna 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
PoojaKrishna Posted September 11, 2018 Share Posted September 11, 2018 7 hours ago, Danp2 said: Change this -- $sCookie = "{""name"":""" & $sName & """,""value"":""" & $svalue & """}" to this -- $sCookie = '{"cookie": {"name":"' & $sName & '","value":"' & $svalue & '"}}' and it should work correctly. Yes, It worked perfect. Thank you so much for being so helpful Dan Link to comment Share on other sites More sharing options...
omarjr16 Posted September 11, 2018 Share Posted September 11, 2018 @Danp2 screenshot dont work correctly (_WD_Window func) Case 'screenshot' $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & $sCommand) you need to change it to Case 'screenshot' $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession &"/"& $sCommand) also "_WD_Timeouts" dont work with chromedriver u can only get the timeouts but not edit them... Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2018 Author Share Posted September 12, 2018 @omarjr16Â Thanks. I'll take a look at the screenshot issue. The timeout issue is a Chrome specific issue, which has been fixed but not currently released. You can read more here. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
timmalos Posted September 12, 2018 Share Posted September 12, 2018 Hey all. Â From http://www.softwareishard.com/blog/har-export-trigger/ : "Basic automated HAR export is already supported by Firefox 41+ and all the user needs to do is set devtools.netmonitor.har.enableAutoExportToFile preference to enable it. As soon as this pref is true, a new HAR file is created automatically for every loaded page and stored in <your-firefox-profile-dir>/har/logs directory. " What would be the good settings to put to capabilities so that it would work with this API? THanks a lot for you help, Link to comment Share on other sites More sharing options...
omarjr16 Posted September 12, 2018 Share Posted September 12, 2018 when i want to navigate to other page he show me an alert how to skip it ?!:c Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2018 Author Share Posted September 12, 2018 @timmalos Probably the simplest solution is to manually run Firefox with the "--marionette" option and then connect to this browser with the following -- _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace --connect-existing --marionette-port 2828') _WD_Option('Port', 4444) Local $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) This way you get to use your standard user profile, so you can have the extension already installed and the prefs setup as desired. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2018 Author Share Posted September 12, 2018 @omarjr16 What have you tried? Show us your code. Have you taken a look at the _WD_Alert function? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
omarjr16 Posted September 12, 2018 Share Posted September 12, 2018 (edited) i must stop asking u everytime ...i wrote __WD_Alert($sSession, 'accept') instead of  _WD_Alert($sSession, 'accept') Edited September 12, 2018 by omarjr16 Link to comment Share on other sites More sharing options...
omarjr16 Posted September 12, 2018 Share Posted September 12, 2018 @Danp2 i noticed that using this udf will take alot of ram (+0.2mb everysec) when i put a loop even if i close the window the session and windows driver everytime .. do u know how to fix that ?! is the problem from ur udf or from my script or maybe from winhttp.au3 /json.au3 Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2018 Author Share Posted September 12, 2018 @omarjr16 Suggest that you post a simple reproducer if you want us to look further into this. Without more information, I can only assume that the issue is in your script. Â Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts