Danp2 Posted September 21, 2019 Author Share Posted September 21, 2019 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 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kiwiman Posted September 21, 2019 Share Posted September 21, 2019 thats the log output not the line of code if look.. so the question mark is not there and it works now as stated with 64bit clean FF 69 but google have some code to check its maximized beforeit loads page prob antibot automation (Bterrds):) Link to comment Share on other sites More sharing options...
Danp2 Posted September 21, 2019 Author Share Posted September 21, 2019 @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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kiwiman Posted September 21, 2019 Share Posted September 21, 2019 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 More sharing options...
Danp2 Posted September 21, 2019 Author Share Posted September 21, 2019 Take a look at the "pageLoadStrategy" option. A forum search should turn up prior discussions. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kiwiman Posted September 21, 2019 Share Posted September 21, 2019 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 More sharing options...
Danp2 Posted September 21, 2019 Author Share Posted September 21, 2019 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CYCho Posted September 21, 2019 Share Posted September 21, 2019 (edited) 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 September 21, 2019 by CYCho Danp2 1 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Letraindusoir Posted September 24, 2019 Share Posted September 24, 2019 (edited) $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 September 24, 2019 by Letraindusoir Link to comment Share on other sites More sharing options...
Danp2 Posted September 24, 2019 Author Share Posted September 24, 2019 @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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Letraindusoir Posted September 24, 2019 Share Posted September 24, 2019 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 More sharing options...
_leo_ Posted September 24, 2019 Share Posted September 24, 2019 Hey @Danp2 I have struggles automating this website: https://www.printful.com The elements I am trying to interact with do not react. Is this because the site is built with a certain framework? Or something else? Thanks Link to comment Share on other sites More sharing options...
Danp2 Posted September 24, 2019 Author Share Posted September 24, 2019 No idea, @_leo_. I took a quick look at the site and nothing immediately jumped out at me as problematic. You'll need to either continue troubleshooting on your own or supply a much more detailed description with code, results from Scite output window, etc. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
_leo_ Posted September 24, 2019 Share Posted September 24, 2019 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. Link to comment Share on other sites More sharing options...
Danp2 Posted September 24, 2019 Author Share Posted September 24, 2019 @_leo_ The code appears to run fine. Can you show the underlying javascript for the click event? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
_leo_ Posted September 25, 2019 Share Posted September 25, 2019 Ok, thank you @Danp2 I am not sure If these are the details you meant. This is a link to the tab, which opened after clicking on the fileupload.js (screenshot). https://static.cdn.printful.com/build/app/build/js/external/jquery-9e52462f5e.fileupload.js If you meant something else, please let me know 🙂 Link to comment Share on other sites More sharing options...
Danp2 Posted September 25, 2019 Author Share Posted September 25, 2019 @_leo_ No, that's not what I was after. Finding the code can be difficult if you're inexperienced in this area. You may want to do some research on this topic. P.S. I found this for you. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
_leo_ Posted September 26, 2019 Share Posted September 26, 2019 Thanks, @Danp2 I will take a look at it and come back to you. Link to comment Share on other sites More sharing options...
_leo_ Posted September 28, 2019 Share Posted September 28, 2019 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 :) 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 More sharing options...
Danp2 Posted September 28, 2019 Author Share Posted September 28, 2019 I don't think the "function definition" thing is an issue. It appears to me that you have given details on two different elements -- a link containing "Upload" and a div. I'm guessing you need to figure out how to show the underlying code for the link and not the div. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts