Need VBA + Selenium expert. WEbsite blocking selenium
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I NEED A SOLUTION IN VBA, NOT IN PYTHON.

I'm trying to access fedex.com with chrome webdriver in VBA but it's blocking it.

This is the code:
dim ChromeWeb As New WebDriver
ChromeWeb.Start "chrome", "https://www.fedex.com"

ChromeWeb.Window.Maximize
ChromeWeb.Get "/"

ChromeWeb.FindElementByXPath("/html/body/div[2]/div[2]/div[5]/div[2]/div/div[1]/div/div/p[1]/a[1]").Click
ChromeWeb.FindElementByXPath("/html/body/div[2]/header/div/div/nav/div/div/div/div[1]/a/span").Click
ChromeWeb.FindElementByName("user").SendKeys "myusername"
ChromeWeb.FindElementByName("pwd").SendKeys "mypass"
ChromeWeb.FindElementByXPath("/html/body/div[2]/header/div/div/nav/div/div/div/div[1]/div/div/form/button").Click

fedex.com blocks selenium with this message "Sorry. Something went wrong. Please re-enter your user name and password to try again." (if you log in in a normal chrome and you put an incorrect user/password, it will display "Login incorrect. Either the user ID or password combination is incorrect or the account has been locked. Please try again or click here to recover your password."

tried to make it headless and other stuff but did not work. I need someone more experienced than me with selenium, to achieve log in on fedex.com and control over it.

thanks!

awarded to rmi

Crowdsource coding tasks.

1 Solution

Winning solution

Hello,

adding this line to your VBA script will prevent the website from detecting Selenium:

ChromeWeb.AddArgument "--disable-blink-features=AutomationControlled"

Insert it before the ChromeWeb.Start line.

I just tried this and FedEx no longer returned 403 error code when trying to login.

Let me know if this works for you, thanks!

Thanks! I tried with the argument above: ChromeWeb.AddArgument "--disable-blink-features=AutomationControlled" ChromeWeb.Start "chrome", "https://www.fedex.com/shipping/shipEntryAction.do?origincountry=ar&locallang=en&urlparams=ar_english" ChromeWeb.Window.Maximize ChromeWeb.Get "https://www.fedex.com/shipping/shipEntryAction.do?origincountry=ar&locallang=en&urlparams=ar_english" ChromeWeb.FindElementByName("username").SendKeys "123" ChromeWeb.FindElementByName("password").SendKeys "123" ChromeWeb.FindElementByXPath("/html/body/div/div[2]/div/form/table/tbody/tr[6]/td/div/table/tbody/tr/td[1]/div/div[2]/table/tbody/tr[6]/td/table/tbody/tr/td[3]/input").Click It's still taking me to a 403 error page and does not allow me to proceed. Any other ideas?
Fred 3 months ago
Here's the code that works for me. I'm using different URL which contains only the login form. https://gist.github.com/radosinsky/7473740b507d57205aed0258f708a4ab Could you try this?
rmi 3 months ago
Thanks, please read comment on github so I can close this work and pay you the bounty. thanks.
Fred 3 months ago