Jump to content

Recommended Posts

Posted
  On 7/26/2021 at 1:09 PM, Danp2 said:

@DrydenYou'll need to "activate" each tab in order to access its contents. You can do with with either _WD_Window or _WD_Attach.

Can't really advise on the other issue without more details. You may want to try retrieving the InnerText property of the body element.

Expand  

OK, thanks for the advice on _WD_Window. I think i got it working:

_WD_Window($sSession, 'Switch', '{"handle":"' & $sTab1 & '"}')
$Source = _WD_GetSource($sSession)
FileWrite("in1.temp", $Source)
_WD_Window($sSession, 'Switch', '{"handle":"' & $sTab2 & '"}')
$Source = _WD_GetSource($sSession)
FileWrite("ri1.temp", $Source)
_WD_Window($sSession, 'Switch', '{"handle":"' & $sTab3 & '"}')
$Source = _WD_GetSource($sSession)
FileWrite("re1.temp", $Source)

You talked about retrieving InnerText property of the body element, can you give me a generic example on how to do that?
Sorry, I'm new to this UDF and am trying to integrate it in an alder script that used _IE

Another question, i noticed the when i use
 

_WD_Window($sSession, "minimize", "")

It minimizes the window, but as soon as i focus on another tab it shows the window again. Is there a property to keep it minimized or even hidden?

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Posted
  On 7/26/2021 at 1:22 PM, Dryden said:

You talked about retrieving InnerText property of the body element, can you give me a generic example on how to do that?

Expand  
; Find the element
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//body")
    
    ;  Retrieve it's innerText attribute
    $sInnerText = _WD_ElementAction($sSession, $sElement, "Attribute", "innerText")

 

  On 7/26/2021 at 1:22 PM, Dryden said:

Is there a property to keep it minimized or even hidden?

Expand  

You have the option of running the browser in headless mode, which would keep it always hidden. Search the forum or use Google for more details. 😉

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 07/28/2021
Posted

Dear DANP2

sorry for late answering you.

"You are doing more than just sending Enter. Where is "lp/sv1020/1aug" being sent to? If an element in the browser, which one? Did you try using _WD_SetElementValue here?"

I used Send function as test and it works instead of _WD_SetElementValue.

and i used 

$B1  = _WD_FindElement($sSession, "xpath", "/html/body.....")

_WD_ElementAction($sSession, $B1, 'Displayed') to get response data flag .

 

P.S. It is actually possible to send Enter to an element using Webdriver commands. I think this has come up previously on the forum (you can try searching on _WD_Action and the 'actions' command), but it's not for the faint of heart.

I found only this in 

_WD_Action($sSession, $sCommand, $sOption = Default)

$sCommand   - one of the following actions:
;                               | refresh
;                               | back
;                               | forward
;                               | url
;                               | title
;                               | actions

 

Many Thanks

Posted

@samibbHere's what I said with additional emphasis added --

  Quote

It is actually possible to send Enter to an element using Webdriver commands. I think this has come up previously on the forum (you can try searching on _WD_Action and the 'actions' command), but it's not for the faint of heart.

Expand  

Not sure why you posted the header for _WD_Action when I already pointed you to this function and its "actions" command. 🙄

Did you attempt to locate the prior discussion(s) on the forum like I suggested?

Posted
  On 8/1/2021 at 5:21 AM, No_Name said:

how to get and click element  waninfo.html

Expand  

You shouldn't post an image of something and then expect us to miraculously provide an accurate answer.

Help us to help you by providing more details,such as --

  • Show us a brief snippet of code showing what you've tried this far (don't post another picture; use the <> icon in the menu bar)
  • Show us the results from the Scite output panel (use <> again)
  • Tell us more about your situation. It appears that you are trying to automate a router. Is that correct?
  • Have you tried navigating to the link's destination href using _WD_Navigate?

 

Posted
  On 8/1/2021 at 12:12 PM, Danp2 said:

You shouldn't post an image of something and then expect us to miraculously provide an accurate answer.

Help us to help you by providing more details,such as --

  • Show us a brief snippet of code showing what you've tried this far (don't post another picture; use the <> icon in the menu bar)
  • Show us the results from the Scite output panel (use <> again)
  • Tell us more about your situation. It appears that you are trying to automate a router. Is that correct?
  • Have you tried navigating to the link's destination href using _WD_Navigate?

 

Expand  

I'm trying to log in to modern 192.168.1.1. After logging in there will be a list to click to check the information.
the code I get but it returns error.
_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@href="waninfo.html"]')

Posted
  On 8/1/2021 at 12:46 PM, No_Name said:

After logging in there will be a list to click to check the information.
the code I get but it returns error.

Expand  

You can't seriously expect us to continue guessing at solutions to a problem that you can't clearly define. Telling us that it returns an error without including any additional details is simply a waste of everyone's time. 🙄

How about this --

  1. Please go back and reread my prior post.
  2. Provide the additional information / details that were requested
Posted

Hi everyone! I was wondering if there is a touch tap method on autoit chrome webdriver that is similar to the selenium TouchActions. Selenium TouchActions has several actions that allowed you to singleTap or doubleTap instead of the _WD_ElementAction to click. _WD_ElementAction works great to click on the element when I'm using the regular chrome method but when I switch it to dev mode and use the mobile emulations, _WD_ElementAction "click" action freezes right after the element are clicked. Is there a solutions or a work around this when using chrome in dev mode with mobile emulations to click or check a button,box, or radio. Here is a source code

<ul class="checkboxes">
                  <li><label class=""><input type="checkbox" id="cond1">Lettuce</label></li>
                  <li><label><input type="checkbox" id="cond2" checked="">Tomato</label></li>
                  <li><label><input type="checkbox" id="cond3">Mustard</label></li>
                  <li><label><input type="checkbox" id="cond4">Sprouts</label></li>
                </ul>

This is what I used to click on the first checkbox. It work perfectly in chrome non dev mode.

Func Box1()
    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='cond1']")
    _WD_ElementAction($sSession, $sButton, 'click')
EndFunc

This is the website https://www.w3.org/TR/wai-aria-practices-1.1/examples/checkbox/checkbox-2/checkbox-2.html

Any suggestions or recommendation would be amazing!! Thanks guys!!!

Posted
  On 8/1/2021 at 1:44 PM, Danp2 said:

You can't seriously expect us to continue guessing at solutions to a problem that you can't clearly define. Telling us that it returns an error without including any additional details is simply a waste of everyone's time. 🙄

How about this --

  1. Please go back and reread my prior post.
  2. Provide the additional information / details that were requested
Expand  

this is error bro

[1627864262.018][INFO]: Waiting for pending navigations...
[1627864262.018][INFO]: Done waiting for pending navigations. Status: ok
[1627864262.028][INFO]: Waiting for pending navigations...
[1627864262.029][INFO]: Done waiting for pending navigations. Status: ok
[1627864262.029][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"partial link text","selector":"WAN Status"}
  (Session info: chrome=92.0.4515.107)
[1627864262.033][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//li[@id='waninfo']/a[1]"
}
[1627864262.033][INFO]: Waiting for pending navigations...
[1627864262.033][INFO]: Done waiting for pending navigations. Status: ok
[1627864262.045][INFO]: Waiting for pending navigations...
[1627864262.045][INFO]: Done waiting for pending navigations. Status: ok
[1627864262.045][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//li[@id='waninfo']/a[1]"}
  (Session info: chrome=92.0.4515.107)
[1627864262.049][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND ClickElement {
   "id": ""
}
[1627864262.049][INFO]: Waiting for pending navigations...
[1627864262.050][INFO]: Done waiting for pending navigations. Status: ok
[1627864262.050][INFO]: Waiting for pending navigations...
[1627864262.051][INFO]: Done waiting for pending navigations. Status: ok
[1627864262.051][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE ClickElement ERROR no such element: Element_id length is invalid
  (Session info: chrome=92.0.4515.107)
[1627864269.619][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//*[href='waninfo.html']"
}
[1627864269.620][INFO]: Waiting for pending navigations...
[1627864269.624][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.633][INFO]: Waiting for pending navigations...
[1627864269.633][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.633][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//*[href='waninfo.html']"}
  (Session info: chrome=92.0.4515.107)
[1627864269.638][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//*[@href=\"waninfo.html\"]"
}
[1627864269.638][INFO]: Waiting for pending navigations...
[1627864269.638][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.647][INFO]: Waiting for pending navigations...
[1627864269.647][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.648][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//*[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864269.652][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "partial link text",
   "value": "WAN Status"
}
[1627864269.652][INFO]: Waiting for pending navigations...
[1627864269.652][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.656][INFO]: Waiting for pending navigations...
[1627864269.657][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.657][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"partial link text","selector":"WAN Status"}
  (Session info: chrome=92.0.4515.107)
[1627864269.662][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864269.662][INFO]: Waiting for pending navigations...
[1627864269.663][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.671][INFO]: Waiting for pending navigations...
[1627864269.671][INFO]: Done waiting for pending navigations. Status: ok
[1627864269.671][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864270.682][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864270.683][INFO]: Waiting for pending navigations...
[1627864270.683][INFO]: Done waiting for pending navigations. Status: ok
[1627864270.687][INFO]: Waiting for pending navigations...
[1627864270.687][INFO]: Done waiting for pending navigations. Status: ok
[1627864270.687][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864271.699][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864271.699][INFO]: Waiting for pending navigations...
[1627864271.700][INFO]: Done waiting for pending navigations. Status: ok
[1627864271.704][INFO]: Waiting for pending navigations...
[1627864271.704][INFO]: Done waiting for pending navigations. Status: ok
[1627864271.704][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864272.718][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864272.718][INFO]: Waiting for pending navigations...
[1627864272.718][INFO]: Done waiting for pending navigations. Status: ok
[1627864272.723][INFO]: Waiting for pending navigations...
[1627864272.723][INFO]: Done waiting for pending navigations. Status: ok
[1627864272.723][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864273.734][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864273.734][INFO]: Waiting for pending navigations...
[1627864273.734][INFO]: Done waiting for pending navigations. Status: ok
[1627864273.739][INFO]: Waiting for pending navigations...
[1627864273.739][INFO]: Done waiting for pending navigations. Status: ok
[1627864273.739][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864274.746][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864274.746][INFO]: Waiting for pending navigations...
[1627864274.747][INFO]: Done waiting for pending navigations. Status: ok
[1627864274.752][INFO]: Waiting for pending navigations...
[1627864274.752][INFO]: Done waiting for pending navigations. Status: ok
[1627864274.752][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864275.762][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864275.762][INFO]: Waiting for pending navigations...
[1627864275.763][INFO]: Done waiting for pending navigations. Status: ok
[1627864275.767][INFO]: Waiting for pending navigations...
[1627864275.767][INFO]: Done waiting for pending navigations. Status: ok
[1627864275.767][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864276.781][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864276.781][INFO]: Waiting for pending navigations...
[1627864276.782][INFO]: Done waiting for pending navigations. Status: ok
[1627864276.786][INFO]: Waiting for pending navigations...
[1627864276.786][INFO]: Done waiting for pending navigations. Status: ok
[1627864276.786][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864277.795][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864277.795][INFO]: Waiting for pending navigations...
[1627864277.796][INFO]: Done waiting for pending navigations. Status: ok
[1627864277.800][INFO]: Waiting for pending navigations...
[1627864277.800][INFO]: Done waiting for pending navigations. Status: ok
[1627864277.800][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864278.810][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864278.810][INFO]: Waiting for pending navigations...
[1627864278.811][INFO]: Done waiting for pending navigations. Status: ok
[1627864278.817][INFO]: Waiting for pending navigations...
[1627864278.817][INFO]: Done waiting for pending navigations. Status: ok
[1627864278.818][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864279.825][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[@href=\"waninfo.html\"]"
}
[1627864279.825][INFO]: Waiting for pending navigations...
[1627864279.825][INFO]: Done waiting for pending navigations. Status: ok
[1627864279.830][INFO]: Waiting for pending navigations...
[1627864279.830][INFO]: Done waiting for pending navigations. Status: ok
[1627864279.830][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href="waninfo.html"]"}
  (Session info: chrome=92.0.4515.107)
[1627864279.834][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//a[contains(text(),\"Wan Status\")]"
}
[1627864279.834][INFO]: Waiting for pending navigations...
[1627864279.835][INFO]: Done waiting for pending navigations. Status: ok
[1627864279.843][INFO]: Waiting for pending navigations...
[1627864279.843][INFO]: Done waiting for pending navigations. Status: ok
[1627864279.843][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//a[contains(text(),"Wan Status")]"}
  (Session info: chrome=92.0.4515.107)
[1627864279.848][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND ClickElement {
   "id": ""
}
[1627864279.848][INFO]: Waiting for pending navigations...
[1627864279.848][INFO]: Done waiting for pending navigations. Status: ok
[1627864279.848][INFO]: Waiting for pending navigations...
[1627864279.849][INFO]: Done waiting for pending navigations. Status: ok
[1627864279.849][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE ClickElement ERROR no such element: Element_id length is invalid
  (Session info: chrome=92.0.4515.107)
[1627864281.041][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND ClickElement {
   "id": ""
}
[1627864281.041][INFO]: Waiting for pending navigations...
[1627864281.042][INFO]: Done waiting for pending navigations. Status: ok
[1627864281.043][INFO]: Waiting for pending navigations...
[1627864281.044][INFO]: Done waiting for pending navigations. Status: ok
[1627864281.044][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE ClickElement ERROR no such element: Element_id length is invalid
  (Session info: chrome=92.0.4515.107)
[1627864281.664][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] COMMAND FindElement {
   "using": "xpath",
   "value": "//*[text()='WAN Status']"
}
[1627864281.665][INFO]: Waiting for pending navigations...
[1627864281.665][INFO]: Done waiting for pending navigations. Status: ok
[1627864281.676][INFO]: Waiting for pending navigations...
[1627864281.676][INFO]: Done waiting for pending navigations. Status: ok
[1627864281.677][INFO]: [98afa7935caaf6ba3581ee6ad025f9a2] RESPONSE FindElement ERROR no such element: Unable to locate element: {"method":"xpath","selector":"//*[text()='WAN Status']"}
  (Session info: chrome=92.0.4515.107)

Posted

@OneSolution Maybe using Javascript.

 

_WD_ExecuteScript($sSession, 'document.getElementById("cond1").checked = true;')

 

Saludos

Posted (edited)

@No_Name you can ask:

How to check it manually ?

Use Google Chorme... go here:
http://tpcg.io/VyKEFf >>> https://www.tutorialspoint.com/online_html_editor.php

Press F12 Key in browser and you will see all the frames

image.png.b7cdfc0fe7f76848bcd374620c7dca4a.png

 

.... then do the same but wiht your desired web page.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 8/1/2021 at 11:18 PM, OneSolution said:

_WD_ElementAction "click" action freezes right after the element are clicked.

Expand  

I would like to take a closer look at this. Can you post a short script that reproduces the issue?

FWIW, this is what I tried but I either don't understand the problem or it doesn't occur for me --

#include "wd_core.au3"
#include "wd_helper.au3"

Local $sDesiredCapabilities, $sSession, $sButton

SetupChrome()
_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)

If @error Then Exit

_WD_Navigate($sSession, "https://www.w3.org/TR/wai-aria-practices-1.1/examples/checkbox/checkbox-2/checkbox-2.html")
DoClick("//input[@id='cond1']")
DoClick("//input[@id='cond2']")
DoClick("//input[@id='cond3']")

Func DoClick($sXpath)
    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sXpath)

    If @error = $_WD_ERROR_Success Then
        Sleep(1500)
        _WD_ElementAction($sSession, $sButton, 'click')
    EndIf
EndFunc

Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "mobileEmulation": {"deviceName": "iPhone X"}, "excludeSwitches": [ "enable-automation"]}}}}'

EndFunc

 

Posted
  On 8/2/2021 at 1:32 AM, Danyfirex said:

@OneSolution Maybe using Javascript.

 

_WD_ExecuteScript($sSession, 'document.getElementById("cond1").checked = true;')

 

Saludos

Expand  

Thank you DanP2 and Danyfirex both code work very well!! I can also do this and it would click on the box!!

_WD_ExecuteScript($sSession, 'document.getElementById("cond1").click()')

If the id element isn't available in the source code except the class and text. How would I execute it in Javascript?  For this source code!

<button type="submit" class="form-control cx-login-control-button">Log In</button>

In regular chrome webdriver this is how I would write the codes to click by class.

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='form-control cx-login-control-button']")
_WD_ElementAction($sSession, $sButton, 'click')

And by text.

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Log In')]")
    _WD_ElementAction($sSession, $sButton, 'click')

Here is my attempt using _WD_ExecuteScript to click on the button by text.

_WD_ExecuteScript($sSession, 'document.getElement(By.Text("Log In")).click()')

And by Class.

_WD_ExecuteScript($sSession, 'document.getElementByClassName("form-control cx-login-control-button")).click()')

Both of these failed in Chrome Dev mode mobile emulation.  Any suggestion? Thanks everyone!! Especially Danyfirex and DanP2.

Posted
  On 8/3/2021 at 12:18 PM, Danp2 said:

@OneSolutionThis thread is reserved for Webdriver UDF development. If you aren't going to provide the requested reproducer script, then I would ask that you move this discussion over to the appropriate thread in the GH&S section (see my sig)

 

Expand  

I apologized Dan. I just figured out how to to use the _WD_ExecuteScript(). Thanks to you and Danyfirex. This discussion can be closed.

Posted
  On 8/5/2021 at 12:54 AM, OneSolution said:

This discussion can be closed

Expand  

Sorry Danp2, we're done talking about WebDriver now :D

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents
Posted (edited)

Does anyone know of any publicly accessible website that will exceed the 10 second time limit:

_WD_LoadWait($sSession, 100, 10000 )

?

I need this to test some feauture which I want to request to the UDF.

Of course I prepeare desired PR on github.com

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...