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
Selenium is capable of executing JavaScript commands with the execute_script method. Few actions like web scrolling cannot be done by Selenium directly. For this, we shall use the JavaScript Executor. We shall take the help of the JavaScript command window.
To simplify the usage of JavascriptExecutor in Selenium, think of it as a medium that enables the WebDriver to interact with HTML elements within the browser. JavaScript is a programming language that interacts with HTML in a browser, and to use this function in Selenium, JavascriptExecutor is required.
answers provided here won't work. instead, use
options.add_argument("--enable-javascript")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With