I can use this code to do a search on google, but when I try it on the golf site, it will say it is unable to connect to the internet. If I type directly into the golf site URL address bar directly, it works. Is the site checking for automate code?
import time
import selenium
import datetime
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.common.exceptions import NoSuchElementException
from datetime import datetime
PATH = “c:\scripts\chromedriver.exe”
options = webdriver.ChromeOptions()
options.add_argument(‘–no-sandbox’)
options.add_argument(‘–no-single-process’)
options.add_argument(‘–disable-dev-sha-usage’)
options.add_argument(‘–incognito’)
options.add_argument(‘–disable-blink-features=AutomationControlled’)
options.add_experimental_option(‘useAutomationExtension’, False)
options.add_experimental_option(“excludeSwitches”, [“enable-automation”])
urlservice=Service(PATH)
driver = webdriver.Chrome(service=urlservice, options=options)
driver.get(‘https://www.google.com’)
time.sleep(2)
esubmit = driver.find_element(By.XPATH,“/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input”)
esubmit.send_keys(“Simon”)
esubmit.submit()
driver.get(‘https://booking.kscgolf.org.hk/login’)
time.sleep(2)
input_username = driver.find_element(By.ID, “username”)
plaese remove the extra space before @simon.com
input_username.send_keys(“simonemail @simon.com”)
input_password = driver.find_element(By.ID, “password”)
input_password.send_keys(“abcd1234”)
time.sleep(1)
esubmit = driver.find_element(By.XPATH,“/html/body/div/div[1]/div[2]/div/div/form/div[2]/div/button”)
esubmit.submit()