Created
January 26, 2022 15:44
-
-
Save kerus1024/de778a95008c0ff7d717d62b60d01068 to your computer and use it in GitHub Desktop.
Windows 운영체제에서 selenium 서버 켜고 VS Remote를 사용해서 WSL서버에 접속하여 작업하기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
서론 | |
windows + 파이선 = 똥 | |
리눅스 + 데스크탑환경 = 똥 | |
windows + wsl = wsl에 gui가없다 | |
해결방안 | |
windows desktop을 gui server로 쓰고 wsl에서 gui server에 요청 | |
python명령은 windows desktop에서 wsl로 (vscode 플러그인) | |
구축 | |
환경구축의 정확한정보 https://qiita.com/yagaodekawasu/items/cbdb00eb085d056e92f0 | |
jdk받고 환경변수 JAVA_HOME 자바폴더와 path환경변수를 바이너리폴더로 지정 | |
셀레니움 따운로드 : https://www.selenium.dev/downloads/ | |
크롬드라이버 따운로드 : https://chromedriver.chromium.org/downloads | |
윈도우크롬과 크롬드라이버는 똑같은버전으로 다운하고 jar가 존재하는 폴더랑 같은 위치에 놓기 | |
실행 | |
wmic process where ExecutablePath='C:\\local\\java\\jdk-16.0.2\\bin\\java.exe' delete | |
set jarfile="\local\mywork\selenium\selenium-server-standalone-3.141.59.jar" | |
start /b java -jar %jarfile% -role hub | |
start /b java -jar %jarfile% -role node -hub http://192.168.161.1:4444/wd/hub | |
개발 | |
WSL에서: pip3 instal selenium | |
from selenium import webdriver | |
chrome_options = webdriver.ChromeOptions() | |
driver = webdriver.Remote( | |
command_executor="http://192.168.161.1:4444/wd/hub", | |
options=chrome_options | |
) | |
driver.get("https://www.naver.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment