끄적끄적

반응형

파이썬에서 하던 거랑 비슷하다.

오토핫키 편집기에서 바로 실행이 안되고 컴파일을 하고 실행해야 돼서 좀 번거롭다.

메인으로 쓰는 오토핫키 프로그램 기능을 수시로 변경도 해줘야 하기 때문에 편집기가 겹치면 그것도 좀 번거롭기도 하고..

셀레니움은 파이썬에서만 쓰고 나중에 필요하면 다시 봐야겠다.

 


 

https://www.the-automator.com/cross-browser-web-scraping-with-autohotkey-and-selenium/

 

https://florentbr.github.io/SeleniumBasic/

다운 받아서 설치하면 C:\Users\사용자이름\AppData\Local\SeleniumBasic 여기에 설치가 된다. 

 

https://iamaman.tistory.com/2021

https://sites.google.com/a/chromium.org/chromedriver/downloads

크롬 버전에 맞는 드라이버 파일을 다운 받아서 압축을 풀고, chromedriver.exe 파일을

C:\Users\사용자이름\AppData\Local\SeleniumBasic 폴더에 덮어쓴다.

 

★★★

* chromedriver.exe 파일과 같은 폴더에서 AHK 파일을 실행해야 한다. 안그러면 오류가 뜬다.

* AHK 파일을 컴파일 하고 EXE 파일을 실행해야 정상적으로 실행이 된다. SciTE4AutoHotkey에서 F5키를 눌러서 실행하면 오류가 뜸

 

https://blog.naver.com/rltkwpdntm/221447626016

 

정리가 잘 되어있는데 아직 사용해 보지 못함..

 

;#1

;driver := ComObjCreate("Selenium.WebDriver")

;driver.Start("chrome","https://www.ppomppu.co.kr/zboard/login.php")

;driver.Get("/")

 

;#2

driver := ComObjCreate("Selenium.CHROMEDriver")

driver.Get("https://www.ppomppu.co.kr/zboard/login.php")

 

 

;#################################

driver.findElementsByName("access").Attribute("innerText") ;access라는 id를 찾음

findElementsByName("") ;객체의 name 부분을 찾음

.Attribute("") ;지정된 객체 element의 원하는 값을 출력

innerText ;범위표시가 되는 element의 모든 텍스트

outerHTML ;지정된 element에 대한 HTML

 

driver.executeScript("?????") ;지정된 element에 대한 스크립트를 실행

 

driver.findElementByTag("P") ;

 

.SendKeys("ex")

 

.click() ;Xpath까지 지정하고 다음에 사용#ClipboardTimeout

driver.FindElementByXpath("~~~~").click()

 

Element(1개)와 Elements(모든=여러개) 구분

driver.findElementsByName("s").item[1].SendKeys("hello world") ;배열 시작은 1부터

 

driver.close()

 


;이거는 익스프롤러로 뽐뿌 로그인 하는 거

 

!tab::

{

se := ComObjCreate("InternetExplorer.Application")

Selenium.ChromeDriver

se.navigate("https://www.ppomppu.co.kr/zboard/login.php")

se.Visible := true  ; This is known to work incorrectly on IE7.

Sleep, 5000

 

;while(1)

;{

;<div class="popup_login">

if(se.document.querySelector(".popup_login"))

{

;<input placeholder="아이디 입력" type="text" name="user_id" id="user_id" maxlength="20">

se.document.querySelector("#user_id").click()

se.document.querySelector("#user_id").value := "aaaa"

Send, {Shift}

;<input placeholder="비밀번호 입력" type="password" name="password" id="password" maxlength="20">

se.document.querySelector("#password").click()

se.document.querySelector("#password").value := "1234"

Send, {Shift}

Send, {Enter} ;로그인 버튼 클릭은 생략, 엔터로 대신한다.

; break

}

; else if (se.document.querySelector("."))

; {

; break

; }

;}

return

}

 

참고 : https://blog.naver.com/6438579_/221678990917

반응형
Please Enable JavaScript!
Mohon Aktifkan Javascript![ Enable JavaScript ]