```python
from selenium import webdriver
from selenium.webdriver.common.by import By
def run():
options = webdriver.ChromeOptions()
options.add_argument("window-size=1280,960")
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.get("https://www.4ksj.com/member.php?mod=logging&action=login")
username_box = driver.find_element(by=By.CSS_SELECTOR, value="input[name=username]")
password_box = driver.find_element(by=By.CSS_SELECTOR, value="input[name=password]")
submit_button = driver.find_element(by=By.CSS_SELECTOR, value="button[name=loginsubmit]")
username_box.send_keys("xxx")
password_box.send_keys("xxx")
submit_button.click()
driver.quit()
run()
```
windows 下运行正常,WSL ubuntu 中运行远程调试发现请求返回“密码错误”
https://imgur.com/QgASihh
将请求 “copy as fetch” 在远程调试 console 运行,失败;拷贝到 windows chrome console 运行成功。
感觉应该是被服务端的某种判断拦截了,有没有什么办法解决呢?
from selenium import webdriver
from selenium.webdriver.common.by import By
def run():
options = webdriver.ChromeOptions()
options.add_argument("window-size=1280,960")
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.get("https://www.4ksj.com/member.php?mod=logging&action=login")
username_box = driver.find_element(by=By.CSS_SELECTOR, value="input[name=username]")
password_box = driver.find_element(by=By.CSS_SELECTOR, value="input[name=password]")
submit_button = driver.find_element(by=By.CSS_SELECTOR, value="button[name=loginsubmit]")
username_box.send_keys("xxx")
password_box.send_keys("xxx")
submit_button.click()
driver.quit()
run()
```
windows 下运行正常,WSL ubuntu 中运行远程调试发现请求返回“密码错误”
https://imgur.com/QgASihh
将请求 “copy as fetch” 在远程调试 console 运行,失败;拷贝到 windows chrome console 运行成功。
感觉应该是被服务端的某种判断拦截了,有没有什么办法解决呢?