-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURLnav.R
More file actions
26 lines (24 loc) · 981 Bytes
/
URLnav.R
File metadata and controls
26 lines (24 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# URL navigation script was designed literally to browse through websites ^_^.
# Personally I needed this to check flows of ad campaigns my agency is running.
# So I wrote a function that navigates through the number of campaigns (it's pretty helpful when n=500+)
library(RSelenium)
library(devtools)
#Open Mozilla
driver <- rsDriver(browser="firefox")
remDr <- driver[["client"]]
remDr$open()
#This function loops through lendings that I'll provide later on
LandClick1 <- function(n) {
# Open url
remDr$navigate(n)
Sys.sleep(0.5)
# Navigate with hyperlink in text(it's the same for all campaigns/links as they lead to the same offer page
remDr$navigate("https://hyperlink.com/click")
Sys.sleep(0.5)
}
# Further I put the vector with links I want to click through
links <- c("https://link.com/n=1",
"https://link.com/fhs=156",
"https://link.com/c=98")
# Inserting links to function one by one
sapply(links, LandClick1)