Jump to content

WebDriver UDF - Help & Support


Recommended Posts


 
$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 by Kyco999
Link to comment
Share on other sites

  • Developers

@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

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

@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 by Danp2
Link to comment
Share on other sites

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

1.png

Link to comment
Share on other sites

$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

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. 😉

Link to comment
Share on other sites

#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

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

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...