8

I am trying to open https://www.guidestar.org/ using selenium webdriver but it is able to detect I am a bot. The email I received says that javascript was not enabled so they were blocking my IP address. Can anyone suggest a code to enable javascripts

user_agent = 'Chrome/73.0.3683.86'
username = os.getenv("USERNAME")
userProfile = "C:\\Users\\" + username + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default"
options = webdriver.ChromeOptions()
options.add_argument(f'user-agent={user_agent}')
options.add_argument("user-data-dir={}".format(userProfile))
driver = webdriver.Chrome(chrome_options=options)
driver.get("http://www.guidestar.org")

I expected the website not to detect that I am a robot

akashav1
  • 77
  • 1
  • 1
  • 2

2 Answers2

20

answers provided here won't work. instead, use

options.add_argument("--enable-javascript")
Ajeet Verma
  • 2,938
  • 3
  • 13
  • 24
Alex Manuele
  • 211
  • 2
  • 4
-1

As supputuri mentioned, add the following chrome option to your argument:

options.add_argument("javascript.enabled", True)
alex067
  • 3,159
  • 1
  • 11
  • 17