김승훈

update crawling_broadcasting information

var async = require('async');
var webdriver = require('selenium-webdriver');
var options = {desiredCapabilities: {browserName: 'chrome'}};
const {Builder, By, Key, until} = require('selenium-webdriver');
const screen = {
width: 640,
height: 480
};
var a=0
var breaktheloop = false
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
let url = 'https://people.search.naver.com/search.naver?where=nexearch&query=%EC%9C%A0%EC%9E%AC%EC%84%9D&sm=tab_etc&ie=utf8&key=PeopleService&os=94702';
driver
.get(url)
.then(() => {
driver.findElement(webdriver.By.id('pagination_76'))
.then ( paginationBtn => {
paginationBtn.findElements(webdriver.By.className('bt_next'))
.then(Btn_next => {
driver.findElement(webdriver.By.id('listUI_76'))
.then(contentsUI => {
contentsUI.findElements(webdriver.By.tagName('li'))
.then(elems => {
elems.forEach(elem => {
elem.getText()
.then(text => {
console.log(text)
})
})
})
clickandget()
function clickandget() {
Btn_next[0].isDisplayed().then(function(state) {
if(state) {
Btn_next[0].click()
sleep(500).then(()=> {
contentsUI.findElements(webdriver.By.tagName('li'))
.then(elems => {
elems.forEach(elem => {
elem.getText()
.then(text => {
console.log(text)
})
})
})
})
}
else {
console.log(state)
}
})
}
})
})
})
})
function getContentsandClickNext(callback) {
driver.findElement(webdriver.By.id('listUI_76'))
.then(contentsUI => {
contentsUI.findElements(webdriver.By.tagName('li'))
.then(elems => {
elems.forEach(elem => {
elem.getTex
})
})
})
}
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
\ No newline at end of file