Jump to content

Recommended Posts

Posted (edited)

but my other problem is not solved. What did I do if there is no ID I can search for?

All other buttons have this HTML code, only the value is the difference and the form where the button lies:

<input type="submit" value="XXX">

example for a button in form 4:

<input type="submit" value="AKM-TR Weitergeleitet">
$FCM_FORMULAR_PPC_DETAILS2 = _IEFormGetObjByName($oIE, "fcmPpcDetailsForm",4)
_IEFormSubmit ($FCM_FORMULAR_PPC_DETAILS2, "AKM-TR Weitergeleitet")
_IELoadWait($oIE)

How can I find this elements and click on it?

Edited by NolleWed
Posted
  On 9/19/2022 at 11:03 PM, Danp2 said:

@NolleWedThere is a list of tools in the Webdriver wiki page that are designed to assist you in identifying the correct xpath or CSS selector.

Expand  

With this link I tried to find out the xpath, but I don´t know what to do: How to search by Xpath/Css in Chrome Developer Tools? | testerlive (wordpress.com)

With F12 I open the console and find the element in HTML code like I always do it

<input type="submit" value="AKM-TR Weitergeleitet">

Then I went to console and type in $x("//input") and get 96 results

The one I need is this:

71: <input type="submit" value="Abbruch ausführen">

accept: ""

accessKey: ""

accessKeyLabel: ""

align: ""

alt: ""

assignedSlot: null

attributes: NamedNodeMap [ type="submit", value="Abbruch ausführen" ]

autocomplete: ""

autofocus: false

baseURI: "https://prodtalos.de.pri.o2.com/talos/fcm/ppc/details.do?command=view&fcmId=158402685"

checked: false

childElementCount: 0

childNodes: NodeList []

children: HTMLCollection { length: 0 }

classList: DOMTokenList []

className: ""

clientHeight: 18

clientLeft: 2

clientTop: 2

clientWidth: 116

contentEditable: "inherit"

dataset: DOMStringMap(0)

defaultChecked: false

defaultValue: "Abbruch ausführen"

dir: ""

disabled: false

draggable: false

files: null

firstChild: null

firstElementChild: null

form: <form name="fcmPpcDetailsForm" method="post" action="/talos/fcm/ppc/details.do">

formAction: "https://prodtalos.de.pri.o2.com/talos/fcm/ppc/details.do?command=view&fcmId=158402685"

formEnctype: ""

formMethod: ""

formNoValidate: false

formTarget: ""

height: 0

hidden: false

id: ""

indeterminate: false

innerHTML: ""

innerText: ""

isConnected: true

isContentEditable: false

labels: NodeList []

lang: ""

lastChild: null

lastElementChild: null

list: null

localName: "input"

max: ""

maxLength: -1

min: ""

minLength: -1

multiple: false

name: ""

namespaceURI: "http://www.w3.org/1999/xhtml"

nextElementSibling: null

nextSibling: #text "
		"

nodeName: "INPUT"

nodeType: 1

nodeValue: null

nonce: ""

offsetHeight: 22

offsetLeft: 336

offsetParent: <td colspan="4" align="center">

offsetTop: 0

offsetWidth: 120

onabort: null

onanimationcancel: null

onanimationend: null

onanimationiteration: null

onanimationstart: null

onauxclick: null

onbeforeinput: null

onblur: null

oncanplay: null

oncanplaythrough: null

onchange: null

onclick: null

onclose: null

oncontextmenu: null

oncopy: null

oncuechange: null

oncut: null

ondblclick: null

ondrag: null

ondragend: null

ondragenter: null

ondragexit: null

ondragleave: null

ondragover: null

ondragstart: null

ondrop: null

ondurationchange: null

onemptied: null

onended: null

onerror: null

onfocus: null

onformdata: null

onfullscreenchange: null

onfullscreenerror: null

ongotpointercapture: null

oninput: null

oninvalid: null

onkeydown: null

onkeypress: null

onkeyup: null

onload: null

onloadeddata: null

onloadedmetadata: null

onloadend: null

onloadstart: null

onlostpointercapture: null

onmousedown: null

onmouseenter: null

onmouseleave: null

onmousemove: null

onmouseout: null

onmouseover: null

onmouseup: null

onmozfullscreenchange: null

onmozfullscreenerror: null

onpaste: null

onpause: null

onplay: null

onplaying: null

onpointercancel: null

onpointerdown: null

onpointerenter: null

onpointerleave: null

onpointermove: null

onpointerout: null

onpointerover: null

onpointerup: null

onprogress: null

onratechange: null

onreset: null

onresize: null

onscroll: null

onseeked: null

onseeking: null

onselect: null

onselectstart: null

onstalled: null

onsubmit: null

onsuspend: null

ontimeupdate: null

ontoggle: null

ontransitioncancel: null

ontransitionend: null

ontransitionrun: null

ontransitionstart: null

onvolumechange: null

onwaiting: null

onwebkitanimationend: null

onwebkitanimationiteration: null

onwebkitanimationstart: null

onwebkittransitionend: null

onwheel: null

outerHTML: "<input type=\"submit\" value=\"Abbruch ausführen\">"

ownerDocument: HTMLDocument https://prodtalos.de.pri.o2.com/talos/fcm/ppc/details.do?command=view&fcmId=158402685

parentElement: <td colspan="4" align="center">

parentNode: <td colspan="4" align="center">

part: DOMTokenList []

pattern: ""

placeholder: ""

prefix: null

previousElementSibling: null

previousSibling: #text "
		"

readOnly: false

required: false

scrollHeight: 18

scrollLeft: 0

scrollLeftMax: 0

scrollTop: 0

scrollTopMax: 0

scrollWidth: 116

selectionDirection: null

selectionEnd: null

selectionStart: null

shadowRoot: null

size: 20

slot: ""

spellcheck: false

src: ""

step: ""

style: CSS2Properties(0)

tabIndex: 0

tagName: "INPUT"

textContent: ""

textLength: 17

title: ""

type: "submit"

useMap: ""

validationMessage: ""

validity: ValidityState { valueMissing: false, typeMismatch: false, patternMismatch: false, … }

value: "Abbruch ausführen"

valueAsDate: null

valueAsNumber: NaN

webkitEntries: Array []

webkitdirectory: false

width: 0

willValidate: true

<prototype>: HTMLInputElementPrototype { stepUp: stepUp(), stepDown: stepDown(), checkValidity: checkValidity(), … }

But now I don´t know how to put this in an xpath code 😌

Normaly I use //input[@name='xxx'] or  //input[@src='xxx'] or //input[@id='xxx'] , but there is no name, scr or id

Please help 

Posted

Can´t use the free tool, because I have no rights to install tools on my PC (at work) :(

 

all buttons with type submit in the HTML code:

<input type="submit" value="XXX">

work fine with this code:

Local $sButton2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@value='XXX']")
_WD_ElementAction($sSession, $sButton2, 'click')
_WD_LoadWait($sSession, 2000)

Thanks

Posted (edited)

I'm working on an AutoIT script to keep Edge Webdriver up to date.  When the logged in user has admin permissions to the computer, the script works well.  If not, both  _WD_IsLatest_Release and _WD_UpdateDriver fail with @error=$_WD_ERROR_GeneralError.  The update also fails when logged in as a standard user using RunAs administrator.

I have attached the script and one of the log files for reference purposes.  At 08:12 in the log file, I ran the script logged in as an admin user.  All other attempts were run as a standard user.

Any suggestions?

 

WebDriverUpdate.au3Fetching info... WebDriverUpdateDebug.logFetching info...

Edited by PaulS
Posted

@PaulSIf you look at _WD_IsLatestRelease, it is simply performing an InetRead against the URL "https://github.com/Danp2/au3WebDriver/releases/latest", which shouldn't require any special permission AFAIK. What OS are you using?

What do you get for output from the following?

Local $sGitURL = "https://github.com/Danp2/au3WebDriver/releases/latest"
    Local $sResult, $aOptions = [0, 1, 2, 3, 4, 8]
    For $iOption In $aOptions
        $sResult = InetRead($sGitURL, $iOption)
        ;### Debug CONSOLE ↓↓↓
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iOption = ' & $iOption & '  >  Error code: ' & @error & @CRLF)
    Next

P.S. I believe there have been past discussions where InetRead was failing on attempts to connect to Github due to security protocols.

Posted

@Danp2  Thanks for the quick reply.   Your comment about InetRead failing due to security protocols got me thinking, so I checked our web content filter.  Guess what...both github.com and msedgedriver.azureedge.net were being blocked for the standard user, and not for the admin user.  THANK YOU!!!

 

  • 2 weeks later...
Posted (edited)

Hi Dan,
thanks again for your work!
Your function _WD_UpdateDriver() checks and installs current webdriver if necessary. In my program I want to show the existing and the new version before the update. 
I have so far only the workaround that I modify the function in wd-helper, so put 2 global variables, which I can then use in my program. However, my modification is gone with each update from you. Is there a way to get the values of $sDriverCurrent and $sDriverLatest somehow also "outside" as global just as information? 

 

Edited by HJL
Posted
  On 10/10/2022 at 4:50 PM, HJL said:

Is there a way to get the values of $sDriverCurrent and $sDriverLatest somehow also "outside" as global just as information? 

Expand  

_WD_GetWebDriverVersion can be used to obtain the $sDriverCurrent. There currently isn't a way for you to get $sDriverLatest unless you download the file into a temporary location and then use the above function on it.

; Remarks .......: When $bForce = Null, then the function will check for an updated webdriver without actually performing the update.
;                  In this scenario, the return value indicates if an update is available.

In theory, we could change the functionality of _WD_UpdateDriver so that it returns an array containing these values when $bForce = Null.

Posted
  On 10/10/2022 at 4:50 PM, HJL said:

Your function _WD_UpdateDriver() checks and installs current webdriver if necessary. In my program I want to show the existing and the new version before the update. 

Expand  

hm...it can be handy in some way in one of my case.

I have a project where browser is only on local network with strongly protected area.
I need to get browser version, store it in INI then update driver on different computer with internet access.

So I need to check browser version, store them, and download related driver later.

This is one of my case on my TODO list.

@Danp2 can we combine this two fatures together ?

 

 

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 (edited)

image.png.0e34d94f85d1ddb0703f17c3870e208f.png

That's output of my program, but works in the moment only with the workaround of 2 global variables.

Edited by HJL
Posted (edited)

Hi @Danp2

I didnt know any Programing language before, but after 1 week finding and copy from this forum, Now I can code by myself a simple script to let my PC automatically grab data from some url and save them.

But all of these urls are simple, so I easily copy whole of the content then edit the strings step by step

And now, I want to grab the data in a not simple website (with me), and I found this topic.

Could you help me how to get the number of shipments in this URL: https://importkey.com/search/TRUONG THANH INCORPORATED COMPANY with the Xpath "//*[@id="mat-tab-label-3-0"]/div/span/app-number-viewerapp"

Thanks.

Edited by hahnhwang
Posted (edited)

 

@hahnhwang

https://www.autoitscript.com/wiki/WebDriver#FAQ #7

You don't need an array in this case. However, 

Local $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="mat-tab-label-0-0"]/div/span/app-number-viewerapp', 100, 5000)
Local $sText = _WD_ElementAction($sSession, $sElement, 'property', 'innerText')

MsgBox(0, "Total", $sText)

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

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

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