Kyco999 Posted July 2, 2019 Share Posted July 2, 2019 (edited) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//click[@id='like_ajax']") _WD_ElementAction($sSession, $sElement, 'click') Help me! How can I click the like button like in the picture? I tried replacing id and class but still not working. Edited July 3, 2019 by Kyco999 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 2, 2019 Developers Share Posted July 2, 2019 @Kyco999, Please do not crosspost in multiple topics! I have removed to other one. While I have your attention: What is your intention with this 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. Link to comment Share on other sites More sharing options...
Progh0st Posted July 3, 2019 Share Posted July 3, 2019 Is it possible for the web driver to tell you when you have an active download, using chrome. If yes how? Link to comment Share on other sites More sharing options...
Kyco999 Posted July 3, 2019 Share Posted July 3, 2019 I solved it. Thanks and sorry @Jos .....but I have new issue How can i get results from _WD_ExecuteScript? $string = _WD_ExecuteScript($sSession, "var content = document.getElementsByClassName('contentpagetop')[0].innerHTML;return content;") MsgBox(0,0,$string) Link to comment Share on other sites More sharing options...
Danp2 Posted July 3, 2019 Author Share Posted July 3, 2019 (edited) @Kyco999 We are not mind readers. 😏 Either post fully executable code for us to test or provide full details on what you are experiencing. For example -- Post the results from the Scite output panel Tell us what was shown in the MsgBox What isn't working as expected? P.S. If the issue is that the result is returned as a JSON string, then that is how _WD_ExecuteScript works. You'll need to extract the desired value using the functions Json_Decode and Json_Get. Edited July 4, 2019 by Danp2 Kyco999 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted July 3, 2019 Author Share Posted July 3, 2019 @Progh0st Not something that I've looked into yet. A quick google search gives some suggestions on how to do this -- https://stackoverflow.com/questions/47462118/how-to-detect-when-all-downloads-finished-with-selenium-webdriver-and-firefox https://gist.github.com/ic0n/a38b354cac213e5aa50c55a0d8b87a0b Kyco999 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Math43 Posted July 3, 2019 Share Posted July 3, 2019 Hello, i've right my first (simple) script with UDF WebDriver and it's working well when i run it from Scite (F5) but after compilation i've a message box error. After clicking on Ok, script is working well.. Message box seems to be triggered by this line: _WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//div[@id='loginForm']") Thanks for your help ! Math Link to comment Share on other sites More sharing options...
Danp2 Posted July 3, 2019 Author Share Posted July 3, 2019 @Math43 You can set $_WD_ERROR_MSGBOX to False to hide these message boxes during runtime. I'll have to take a further look at the code to see why it is showing an error on success. Math43 and Kyco999 1 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Letraindusoir Posted July 3, 2019 Share Posted July 3, 2019 $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "???") if $sElement then msgbox(0,'',"OK!") please,if I want to find out if there is a string in the entire web page, no matter where it is,how should I write the xpath? Metaphorically, look for strings "What isn't working as expected" on this page... Link to comment Share on other sites More sharing options...
Letraindusoir Posted July 3, 2019 Share Posted July 3, 2019 By the way, where can I get the UDF "_WD_ConsoleVisible"? Link to comment Share on other sites More sharing options...
Danp2 Posted July 3, 2019 Author Share Posted July 3, 2019 @Letraindusoir It's in the latest release on Github (see my sig) Kyco999 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted July 3, 2019 Author Share Posted July 3, 2019 1 hour ago, Letraindusoir said: please,if I want to find out if there is a string in the entire web page, no matter where it is,how should I write the xpath? Don't believe you can do it with _WD_FindElement. Take a look at _WD_GetSource. Once you have the source, you can then search it for whatever your heart desires. 😉 Kyco999 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Kyco999 Posted July 4, 2019 Share Posted July 4, 2019 #include "wd_core.au3" #include "wd_helper.au3" Local $sSession Local $sDesiredCapabilities SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://whoer.net/") MsgBox(0,0,0) _WD_DeleteSession($sSession) _WD_Shutdown() 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": ["disable-web-security"], "proxy": {"proxyType":"manual","httpProxy":"3.83.95.178:8888","sslProxy":"3.83.95.178:8888","autodetect": "false"}}}}' EndFunc I use this code to change proxy but it doesn't working anything!! Can you teach me how to set proxy for chrome? Link to comment Share on other sites More sharing options...
Math43 Posted July 4, 2019 Share Posted July 4, 2019 Hello, did you know is there is any to get PID of chrome process launch by chromedriver.exe ? I want to close webdriver console if user close tab or browser. Thanks ! Regards, Mathieu Link to comment Share on other sites More sharing options...
Letraindusoir Posted July 4, 2019 Share Posted July 4, 2019 14 hours ago, Danp2 said: Don't believe you can do it with _WD_FindElement. Take a look at _WD_GetSource. Once you have the source, you can then search it for whatever your heart desires. 😉 The web source code get by using _WD_GetSource,it doesn't seem to be able to get the asynchronous loaded part, which can see from the web source code obtained by F12 devtools Link to comment Share on other sites More sharing options...
Letraindusoir Posted July 4, 2019 Share Posted July 4, 2019 15 hours ago, Danp2 said: @Letraindusoir It's in the latest release on Github (see my sig) yes,I finded it,thanks dan! It is in the form of hidden windows. I'm going to use winmove to move it off the screen, and I guess it will work better. Link to comment Share on other sites More sharing options...
Danp2 Posted July 4, 2019 Author Share Posted July 4, 2019 1 hour ago, Letraindusoir said: It is in the form of hidden windows. I'm going to use winmove to move it off the screen, and I guess it will work better Care to elaborate? What's wrong with the current implementation of _WD_ConsoleVisible? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted July 4, 2019 Author Share Posted July 4, 2019 3 hours ago, Kyco999 said: I use this code to change proxy but it doesn't working anything!! Can you teach me how to set proxy for chrome? Not something that I've had a need to do yet. However, this has been discussed previously in both this thread and the development one, so perhaps you can figure it out from those prior discussions. Kyco999 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted July 4, 2019 Author Share Posted July 4, 2019 2 hours ago, Math43 said: did you know is there is any to get PID of chrome process launch by chromedriver.exe ? I want to close webdriver console if user close tab or browser You should be able to do this without resorting to tracking the PID of the launched process. The UDF will return an error under the conditions you described. Math43 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Math43 Posted July 4, 2019 Share Posted July 4, 2019 1 hour ago, Danp2 said: You should be able to do this without resorting to tracking the PID of the launched process. The UDF will return an error under the conditions you described. I've not see any error when I close browser, script is "only" waiting. Could you tell me a little more about ? Thanks ! Link to comment Share on other sites More sharing options...
Recommended Posts