Jump to content

WebDriver UDF - Help & Support


Recommended Posts

8 hours ago, kiwiman said:

is your 64bit or 32bit.. maybe makes a difference

I believe mine is the 64 bit version. Make sure that you run the matching version of geckodriver (they release both 32bit and 64bit versions)

Quote

is there a way to show and hide those command windows

Yes... see my previous answer here.

Quote

also at some stage I want the browsers no to open up over stuff.. I guess compat option run minimize solves that part

You'll want to research running the browser in "headless" mode

Quote

_WDStartup: Params:    --log trace --connect-existing --marionette-port? 2828

The question mark shouldn't be there. Possibly you're running into the forum bug where there's an extra "hidden" character when you copy and paste code

 

Link to comment
Share on other sites

@kiwiman Right... but I suspect that there's a non-visible character in this location. You may have accidentally fixed it when you updated that line of code.

Can you post a short example script that demonstrates the issue you're seeing with Google?

P.S. Be sure to use the Code button in to toolbar (looks like <>) when posting code.

Link to comment
Share on other sites

Ok I hear you about the hidden character.. I think I backspace a bit but made

no difference to the 32bit driver though.. something going on there

but I do have a few plugins on it.. like ublock etc. 

------

unless you got a google YouTube channel... its hard for you to test

but load the studio dashboard while it was min.. wont load

and the script moves mo and so scrapes nothing

 

Im using 5sec pause to wait for page to load too

but I see no where to tell it to wait until its fully loaded.. the sleep

worked though more then enough time.

Link to comment
Share on other sites

are you saying that will fix google?

 

heres a snippet.. I scrape subs from my admin page as they change the api to 

be first 3 digits.. but I wanted a better counter for my lives

 

if I started FF 64bit and yes using the 64 driver with it stored in windows folder

and then min, the browser then click go for the code to load and scrap and 

show in a small gui

it works for scraping bitchute stats

but google wont load until I  click tray and open max.

so it finds nothing since didnt load.. but bitchute finds min or max-ed browser FF

i spent 3 days solid on the code as I hate coding and having to learn it.

and figure how to get your addons working with autoit.. but I managed

I need to add err checking now if fails and reload and check every 5min

somehow.. and avoid cache issues... 

==

 

Func YTElements()

    _WD_Navigate($sSession, "https://studio.youtube.com/channel/UCmQPGMaPINfxW9cHV-xtmUA")
    sleep(5000)

    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='metric-value-big style-scope ytcd-channel-facts-item']")
    $sYTSubsText = _WD_ElementAction($sSession, $sElement,'text')
    ConsoleWrite('YTSubs = ' & $sYTSubsText & @CRLF)

EndFunc

Func SetupGecko()
_WD_Option('Driver', 'geckodriver.exe')
;_WD_Option('DriverParams', '--log trace')
;the robot marionette using existing open Firefox browser only works for 64bit version
;make sure loging google and set login cookies first
;32bit v68 gives exception error for --connect-existing
_WD_Option('DriverParams', '--log trace   --marionette-port 2828 --connect-existing  ')
_WD_Option('Port', 4444)
$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc

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 }}}}'
$sDesiredCapabilities='{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", "goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, "args": ["start-maximized"] }}}}'
;$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars","user-data-dir=C:\\Users\\Paul\\AppData\\Local\\Google\\Chrome\\User Data"] }}}}'
EndFunc

Func SetupEdge()
_WD_Option('Driver', 'MicrosoftWebDriver.exe')
_WD_Option('Port', 17556)
_WD_Option('DriverParams', '--verbose')

$sDesiredCapabilities = '{"capabilities":{}}'
EndFunc

Link to comment
Share on other sites

I'm saying that you could try a different setting for pageLoadStrategy and then report back your findings. Another option is to use _WD_WaitElement to loop until the desired element has appeared.

You may want to post the results from the Scite output panel. Not sure I can be of further assistance since I can't test this on my end.

Link to comment
Share on other sites

As a follow-up to my question about "save password" balloon in ChromeDriver, I figured out how to disable it. Please refer to my current configuration of $sDesiredCapabilities below:

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _
    '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _
    '"prefs": {"credentials_enable_service": false}, "args": ["start-maximized"] }}}}'

 

Edited by CYCho
Link to comment
Share on other sites

$sResp={"value":[{"element-6066-11e4-a52e-4f735466cecf":"b3b72d24-d529-4887-9027-431ba1dad83c"}]}
$sJSON = Json_Decode($sResp)
$sElem = Json_Get($sJSON, "[value]")

As shown above,

how do I further extract 'b3b72d24-d529-4887-9027-431ba1dad83c" from $sResp?

 

Conversely, if I want to import
 

"element-6066-11e4-a52e-4f735466cecf":"da9cad9f-06a0-47af-adbc-bfb3be2aa7f5"

"element-6066-11e4-a52e-4f735466cecf":"df678cd1-891d-42f5-a698-a63074beb879"

into

$sResp={"value":[{"element-6066-11e4-a52e-4f735466cecf":"b3b72d24-d529-4887-9027-431ba1dad83c"}]}

and make it

$sResp={"value":[{"element-6066-11e4-a52e-4f735466cecf":"b3b72d24-d529-4887-9027-431ba1dad83c"},{"element-6066-11e4-a52e-4f735466cecf":"da9cad9f-06a0-47af-adbc-bfb3be2aa7f5"},{"element-6066-11e4-a52e-4f735466cecf":"df678cd1-891d-42f5-a698-a63074beb879"}]}

how can I operate it?
I'm not familiar with JSON operation, and I don't understand json. Au3 very well. Please give me advice!

Edited by Letraindusoir
Link to comment
Share on other sites

2 hours ago, Danp2 said:

@Letraindusoir This is directly from _WD_FindElement --

$sResult = Json_Get($oJson, "[value][" & $_WD_ELEMENT_ID & "]")

On you other question, I would recommend taking a look at the Json_Put function. Also, you could just build the string manually.

Thank you Dan. There are not too many examples, It's not easy to understand in a short period of time.

Link to comment
Share on other sites

Thank you @Danp2 

Since I am clueless on what to do from here, I am trying to give you as much information as possible. If you need to know anything else, please let me know.

I am running Chrome Version 77.0.3865.90  with the appropriate  Chromedriver. 

Here is a part of my code:

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@class='btn btn-danger btn-block' and contains(text(),'Upload')]", $iPause*5, $iPause*50, True)
$Upload = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@class='btn btn-danger btn-block' and contains(text(),'Upload')]")
_WD_ElementAction($sSession, $Upload, 'click')

and here is the output. As you can see, it finds the element and interacts with it, but nothing happens.

Quote

__WD_Post: URL=HTTP://127.0.0.1:9515/session/861f673d966d15b8d36f296f2d8efa22/element; $sData={"using":"xpath","value":"//a[@class='btn btn-danger btn-block' and contains(text(),'Upload')]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"a724ff79-caf4-4f01-99af-b28c013ee1e4"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"a724ff79-caf4-4f01-99af-b28c013ee1e4"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/861f673d966d15b8d36f296f2d8efa22/element/a724ff79-caf4-4f01-99af-b28c013ee1e4/displayed
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/861f673d966d15b8d36f296f2d8efa22/element; $sData={"using":"xpath","value":"//a[@class='btn btn-danger btn-block' and contains(text(),'Upload')]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"a724ff79-caf4-4f01-99af-b28c013ee1e4"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"a724ff79-caf4-4f01-99af-b28c013ee1e4"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/861f673d966d15b8d36f296f2d8efa22/element/a724ff79-caf4-4f01-99af-b28c013ee1e4/click; $sData={"id":"a724ff79-caf4-4f01-99af-b28c013ee1e4"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...

In the Event Listeners I found that Click should trigger the element.Autoit.thumb.PNG.32847fc0b9286e9096db67d604554ac6.PNG

Link to comment
Share on other sites

Hey there

I used the Visual Event tool. On all Elements, I got the message: "Function definition could not be found automatically". I guess this should not be the case, right? Apart from that, the "upload" button seems not to have a functional underlying javascript code. (see below) I hope you can make some conclusions with the given information.

Thanks as always :)

1349665315_Screenshot(2).thumb.png.0b4bd95b3f157bc1fd72911c36bff8b2.png

Quote

function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...