Jump to content

WebDriver UDF - Help & Support (III)


Danp2
 Share

Recommended Posts

8 minutes ago, 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.

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.

Link to comment
Share on other sites

21 minutes ago, Dryden said:

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

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

 

23 minutes ago, Dryden said:

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

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

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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

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?

Link to comment
Share on other sites

6 hours ago, No_Name said:

how to get and click element  waninfo.html

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?

 

Link to comment
Share on other sites

32 minutes ago, 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?

 

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"]')

Link to comment
Share on other sites

54 minutes ago, 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.

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

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!!!

Link to comment
Share on other sites

10 hours ago, 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

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)

Link to comment
Share on other sites

@OneSolution Maybe using Javascript.

 

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

 

Saludos

Link to comment
Share on other sites

@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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

12 hours ago, OneSolution said:

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

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

 

Link to comment
Share on other sites

On 8/1/2021 at 6:32 PM, Danyfirex said:

@OneSolution Maybe using Javascript.

 

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

 

Saludos

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.

Link to comment
Share on other sites

On 8/3/2021 at 5:18 AM, 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)

 

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

Link to comment
Share on other sites

13 hours ago, OneSolution said:

This discussion can be closed

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.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 07/29/2022
  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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