Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강상위
/
my-broadcasting
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김승훈
2018-12-07 23:02:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
58b6197d4528a59358ba5ff058e7c0ce1c4799f2
58b6197d
1 parent
8ec7e6bc
update crawling_broadcasting information
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
crawling_broadcasting.js
crawling_broadcasting.js
0 → 100644
View file @
58b6197
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
Please
register
or
login
to post a comment