1

I'm new to Python. I'm trying to do automation by opening a login page in Selenium.

from selenium import webdriver
browser = webdriver.Chrome(executable_path='chromedriver')

I tried to test some sites like - 'https://www.google.com/',etc. which is working perfectly fine.

url = 'https://www.google.com/'
browser.get(url)

I'm trying to open below url,

url = 'https://yesonline.yesbank.co.in/index.html?module=login'
browser.get(url)

I got the following error in selenium browser while the url is working fine without selenium.

Access Denied

You don't have permission to access "http://yesonline.yesbank.co.in/index.html?" on this server.

Reference #18.ef87d317.1625646692.41fe4bc0

But when I'm trying to just open the base url, it is opening but the site gets loads partially and keep showing loading.

url = 'https://yesonline.yesbank.co.in'
browser.get(url)

I feel like I am missing out something while opening the login url which I'm not able to get what exactly.

I also tried changing the webdriver i.e with Firefox.

url = 'https://yesonline.yesbank.co.in'
firefox_browser = webdriver.Firefox()

And guess what, it was opening! But as soon as I'm trying to get the login page (even by manually using the mouse and clicking login page).

url = 'https://yesonline.yesbank.co.in/index.html?module=login'
firefox_browser.get(url)

'firefox_browser' is getting closed with an session reset error.

Can someone help me how to open secure sites in selenium. Or is there any other way to get it done.

David
  • 366
  • 3
  • 22
  • Do you try to get api response from this link? – Muhtar Jul 07 '21 at 08:26
  • I would advise you to setup a simple http request monitoring and look at the request you're doing. Compare the selenium call against an ordinary Chrome call. There might be differences which the bank site (like a useragent) checks. – Marvin Jul 07 '21 at 08:57
  • Try this: https://stackoverflow.com/questions/58679718/selenium-how-to-avoid-access-denied-page – jizhihaoSAMA Jul 07 '21 at 10:46
  • @jizhihaoSAMA Thanks & I tried that, but no change! – David Jul 07 '21 at 11:14

1 Answers1

0

It's finally working with chrome-driver by adding some arguments to it.

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('disable-infobars')
options.add_argument('--disable-extensions')
options.add_argument('--disable-blink-features=AutomationControlled')

browser = webdriver.Chrome(executable_path='chromedriver', options = options)
David
  • 366
  • 3
  • 22