Jump to content

Recommended Posts

Posted (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 by Kyco999
Posted

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)

 

Posted (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 by Danp2
Posted

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

Posted
$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...

Posted
#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?

Posted

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

Posted
  On 7/3/2019 at 6:24 PM, 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. 😉

Expand  

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

Posted
  On 7/4/2019 at 7:52 AM, 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?

Expand  

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.

Posted
  On 7/4/2019 at 11:27 AM, 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.

Expand  

I've not see any error when I close browser, script is "only" waiting.

 

Could you tell me a little more about ?

 

Thanks !

Guest
This topic is now closed to further replies.
×
×
  • Create New...