4

I am trying to login to my e-trade account via selenium and/or chrome_driver, but each time I attempt to login e-trade seems to be able to detect that I am using a webdriver and block the login. Is there any way for me to point my chrome driver to my normal chrome session? or prevent etrade from detecting that I am using one of these drivers? I have read a few other SO posts that have suggested some workarounds, but so far nothing has worked. I have tried both webdrivers on chrome and firefox, also tried clearing my cookies before login.

I am on ChromeDriver 76.0.3809.126 and Selenium server version: 3.141.59, any suggestions to get around this would be greatly appreciated.

jfarn23
  • 232
  • 2
  • 10
  • 2
    refer: https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver – Shubham Jain Sep 02 '19 at 09:50
  • I attempted to use the accepted answer from this post and it did not work on my version of chrome driver. – jfarn23 Sep 02 '19 at 16:38
  • there are too many solution avaiable on that thread, you should try each one atleast those having upvoted not just accepted answer – Shubham Jain Sep 03 '19 at 08:45

2 Answers2

7

I use python asyncio and pyppeteer with chrome to automate the login into etrade. A few months ago etrade changed something and I started getting blocked. With headless set to False I could see an error warning that stated to call etrade with the IP address. After a long back and forth they sent me a set of cookies (see below) that needed to be passed with a customer value specific to my account. Once they gave me the ETWLCUST1 value for the value key everything was golden from there on out. This isn't documented on the site so it was painful to figure out, but it worked for me. This may be what is blocking your access. I also passed user-agents prior to whatever etrade changed, and I still do, so that wasn't the issue for me.

Good luck if it works!

cookies = {'name':'SWH','value':'ETWLCUST1-xxxxxxx-xxxx','domain':'.etrade.com','secure':True,'httpOnly':True}
Jonathan Leon
  • 5,440
  • 2
  • 6
  • 14
2

To achieve this you need to use the chrome User-Agent command-line option:

As you have not mentioned which language you are using, I am writing code in Java and Python.

To achieve this you need to use the chrome user-agent command line option.

JAVA:

ChromeOptions options = new ChromeOptions();
options.addArguments("--user-agent="+ PUT_USER_AGENT_HERE);
WebDriver driver = new ChromeDriver(options);

PYTHON:

opts = Options()
opts.add_argument("user-agent=PUT_USER_AGENT_HERE") 
driver = webdriver.Chrome(chrome_options=opts)

How to get the User-Agent:

  • Open your actual browser.
  • Right-click and open inspect element.
  • Now go to console.
  • Now copy-paste below code.

Code:

navigator.userAgent

Example: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

Abhishek Dhoundiyal
  • 1,359
  • 1
  • 12
  • 19
  • I am using elixir, do you know of a way to alter the user agent using that syntax? If not, I may just learn python and switch my script over to that as I have seen a lot more flexibility with python and the chrome driver – jfarn23 Sep 02 '19 at 16:15
  • 1
    update: I was able to switch my user agent and the login is still being prevented :/ – jfarn23 Sep 02 '19 at 16:35