For some websites, using default chromedriver will be detected and blocked.
To avoid this, we need to start chrome and chromdriver manually.
In Windows
Close all chrome browsers
In the Chrome location open a terminal and enter
chrome.exe --remote-debugging-port=9222
{% asset_img "cmd.PNG" %}
- To make sure it works open browser with
127.0.0.1:9222/json
it should display
Configure Chrome Option
from selenium.webdriver.chrome.options import Options
chrome_option = Options()
chrome_option.add_argument("--disable-extensions")
chrome_option.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
Add Chrome Option to the Driver, Now we can control the chrome driver with the current instance
curr_path = os.path.dirname(os.path.realpath("__file__"))
chrome_path = "/".join([curr_path,"cd","chromedriver.exe"])
driver = webdriver.Chrome(chrome_path, options=chrome_option)