NSearch Posted January 8, 2020 Share Posted January 8, 2020 (edited) Hi Danp2, Sorry....I should have done that -- it was such a brief example, I thought my explanation covered it. Below is the snippet of code I am trying: _WD_Navigate($sSession, "https://www.fedex.com/servlet/InvoiceServlet?link=4&jsp_name=adjustment&orig_country=US&language=english") This code above navigates to a generic FedEx page -- not the intended page (undesired_result.png) that I can navigate to manually (desired_result.png). Second attempt is to go to the parent page and click on a link vs trying to directly navigate (above example): _WD_Navigate($sSession, "https://www.fedex.com/en-us/customer-support/claims.html") $sLink = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[2]/div[4]/div[2]/div[1]/div[1]/div/div[1]/div[2]/div/a") _WD_ElementAction($sSession, $sLink, 'click') Both attempts give the same result. Please see the attached images. Edited January 8, 2020 by NSearch Link to comment Share on other sites More sharing options...
Danp2 Posted January 8, 2020 Author Share Posted January 8, 2020 @NSearch I'm guessing it has something to do with missing cookies, because it works as expected if you initially navigate to the main fedex.com website. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NSearch Posted January 9, 2020 Share Posted January 9, 2020 Thanks for the reply Danp2. Is it working for you when you initially navigate to the main page? Neither of these work for me. _WD_Navigate($sSession, "https://www.fedex.com") _WD_Navigate($sSession, "https://www.fedex.com/servlet/InvoiceServlet?link=4&jsp_name=adjustment&orig_country=US&language=english") _WD_Navigate($sSession, "https://www.fedex.com") _WD_Navigate($sSession, "https://www.fedex.com/en-us/customer-support/claims.html") $sLink = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[2]/div[4]/div[2]/div[1]/div[1]/div/div[1]/div[2]/div/a") _WD_ElementAction($sSession, $sLink, 'click') Link to comment Share on other sites More sharing options...
Danp2 Posted January 9, 2020 Author Share Posted January 9, 2020 Yes, it worked for me using both Chrome and Firefox. However, further attempts to open a new request failed. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NSearch Posted January 9, 2020 Share Posted January 9, 2020 (edited) Thanks for the reply Danp2. Do you have any suggestions on what I should do. Would you share what you are using for $sDesiredCapabilities? btw, I am using FireFox Thanks Edited January 9, 2020 by NSearch Link to comment Share on other sites More sharing options...
Danp2 Posted January 9, 2020 Author Share Posted January 9, 2020 44 minutes ago, NSearch said: Do you have any suggestions on what I should do. Would you share what you are using for $sDesiredCapabilities? Not really. DesiredCapabilities are very basic == $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NSearch Posted January 9, 2020 Share Posted January 9, 2020 Thanks for trying Danp2. Does anyone else have suggestions? Link to comment Share on other sites More sharing options...
CYCho Posted January 9, 2020 Share Posted January 9, 2020 I agree with @Danp2 that it may have something to do with the cookies. I included my default user data directory in the capabilities and it worked OK. One thing you must remember is that you must close all existing Chrome browser sessions before running this script because every chromedriver session needs a unique user data directory. #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities $_WD_DEBUG = $_WD_Debug_Info ;None $_WD_ERROR_MSGBOX = False SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) Sleep(1000) _WD_LoadWait($sSession) _WD_Navigate($sSession, "https://www.fedex.com/servlet/InvoiceServlet?link=4&jsp_name=adjustment&orig_country=US&language=english") Func SetupChrome() If Not FileExists("chromedriver.exe") Then MsgBox(4096, "", "ChromeDriver is not available in the sript directory!") Exit EndIf _WD_Option('Driver', 'chromedriver.exe') _WD_Option('DriverParams', '--log-path=chrome.log') _WD_Option('Port', 9515) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _ '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _ '"prefs": {"credentials_enable_service": false}, ' & _ '"args": ["start-maximized", "user-data-dir=C:\\Users\\(put your user name here)\\AppData\\Local\\Google\\Chrome\\User Data", "profile-directory=Default"] }}}}' EndFunc zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
NSearch Posted January 9, 2020 Share Posted January 9, 2020 Thank you very much CYCho. Have you also attempted with FireFox? Link to comment Share on other sites More sharing options...
CYCho Posted January 9, 2020 Share Posted January 9, 2020 No, I don't use Firefox. But I think it would be the same with Firefox. Some of my options may not be applicable to Firefox. You can omit them. zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
NSearch Posted January 9, 2020 Share Posted January 9, 2020 (edited) I get the same result (We're sorry, we can't process your request at this time), with your code, in Chrome. Is there a function that will delete all cookies in Firefox? Edit: found it: _WD_Cookies($sSession,'delete') I added that after the session is created and I still get the same result. Edited January 9, 2020 by NSearch Link to comment Share on other sites More sharing options...
CYCho Posted January 9, 2020 Share Posted January 9, 2020 (edited) Did you previously visit the FedEx site manually using Chrome.exe, that way installing their cookies in the default user data directory? Mine works 100% of the time. Edited January 9, 2020 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
NSearch Posted January 9, 2020 Share Posted January 9, 2020 (edited) Excellent -- that worked! Thank you Now I just need to figure out how to get it to work with Firefox.....if that's too challenging, I'll update the code to work with Chrome. Edited January 9, 2020 by NSearch Link to comment Share on other sites More sharing options...
NSearch Posted January 10, 2020 Share Posted January 10, 2020 Back to not working -- is your script still working @CYCho ? Link to comment Share on other sites More sharing options...
CYCho Posted January 10, 2020 Share Posted January 10, 2020 Yes, it does. If you had _WD_Cookies($sSession,'delete') in your code that you ran the last time, that might be the problem. If that's the case, you will have to manually visit the site again and then run the code without that line. zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
NSearch Posted January 11, 2020 Share Posted January 11, 2020 Thanks @CYCho I am now able to get back to the page, but there's another problem -- will you please check to see if you're having the same result? When I reach https://www.fedex.com/servlet/InvoiceServlet?link=4&jsp_name=adjustment&orig_country=US&language=english I click on FedEx Ground, "I received a FedEx invoice(Electronic or paper), then "Make a new request". When I do, I get an error: "Access to www.fedex.com was denied" $sElement_Ground_Radio = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div/div[2]/div/table/tbody/tr[2]/td/table/tbody/tr/td[3]/table[2]/tbody/tr/td[2]/form/table/tbody/tr/td/table/tbody/tr/td[2]/table[1]/tbody/tr[2]/td[1]/input") _WD_ElementAction($sSession, $sElement_Ground_Radio, 'click') $sElement_Pay_Radio = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div/div[2]/div/table/tbody/tr[2]/td/table/tbody/tr/td[3]/table[2]/tbody/tr/td[2]/form/table/tbody/tr/td/table/tbody/tr/td[2]/table[2]/tbody/tr[1]/td[3]/input") _WD_ElementAction($sSession, $sElement_Pay_Radio, 'click') $sElement_Submit_Radio = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div/div[2]/div/table/tbody/tr[2]/td/table/tbody/tr/td[3]/table[2]/tbody/tr/td[2]/form/table/tbody/tr/td/table/tbody/tr/td[2]/table[3]/tbody/tr[1]/td/input") _WD_ElementAction($sSession, $sElement_Submit_Radio, 'click') Link to comment Share on other sites More sharing options...
CYCho Posted January 11, 2020 Share Posted January 11, 2020 It seems that the web site detects my geolocation and denies my access to these pages, so I can't go any further. They have a Korean page, which is quite different from the US one. By any chance, wouldn't these pages require a log in? zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Danp2 Posted January 18, 2020 Author Share Posted January 18, 2020 New version released on Github that fixes a couple of bugs. Please update ASAP. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NSearch Posted January 21, 2020 Share Posted January 21, 2020 On 1/11/2020 at 6:05 PM, CYCho said: It seems that the web site detects my geolocation and denies my access to these pages, so I can't go any further. They have a Korean page, which is quite different from the US one. By any chance, wouldn't these pages require a log in? Hi CYCho, The pages do not require logging in. Do you know how to create an incognito session? Link to comment Share on other sites More sharing options...
CYCho Posted January 21, 2020 Share Posted January 21, 2020 @NSearch You can include "incognito" in the "args" section of $sDesiredCapabilities. zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now