네이버 로그인
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Exam02 {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://nid.naver.com/nidlogin.login?mode=form&url=https%3A%2F%2Fwww.naver.com");//
driver.findElement(By.id("id")).sendKeys("ABCD");
driver.findElement(By.id("pw")).sendKeys("password");
// driver.findElement(By.id("log.login")).click(); // 네이버에서 아이피밴 받을 수도있다. + 네이버에선 자동화툴 차단 기능 있음
Thread.sleep(5000);
driver.close();
}
}
1) 느리게 설정 - 자동화툴 쓰는 의미 없음
2) 우회책
Ctrl + C
Ctrl + V
로 입력하면 된다.
다음 로그인
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class quiz01 {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://logins.daum.net/accounts/signinform.do?url=https%3A%2F%2Fwww.daum.net%2F");
driver.findElement(By.id("id")).sendKeys(Account.id);
driver.findElement(By.id("inputPwd")).sendKeys(Account.pw);
driver.findElement(By.id("loginBtn")).click();
Thread.sleep(5000);
driver.close();
}
}
public class Account {
public static final String id ="";
public static final String pw ="";
}
'디지털 컨버전스 > Selenium' 카테고리의 다른 글
| [Selenium] iframe - 내게쓰기 입력 (0) | 2020.04.22 |
|---|---|
| [Selenium] 자바스크립트 입력 - 로그인 (0) | 2020.04.22 |
| [Selenium] 명시적 대기 (0) | 2020.04.22 |
| [Selenium] id값을 모르는 경우 선택하기 (0) | 2020.04.21 |
| [Selenium] 설치 / 검색 기능 (0) | 2020.04.21 |