LoginSession: Open a logged in Session

Description Usage Arguments Value Author(s) Examples

Description

Simulate authentifaction using web driver automation This function Fetch login page using phantomjs web driver(virtual browser), sets login and password values + other required values then clicks on login button. You should provide these agruments for the function to work correctly : - Login page URL - Login Credentials eg: email & password - css Or Xpath of Login Credential fields - css or xpath of Login Button - If a checkbox is required in the login page then provide provide its css or xpath pattern

Usage

1
2
3
LoginSession(Browser, LoginURL, LoginCredentials, cssLoginFields,
  cssLoginButton, cssRadioToCheck, XpathLoginFields, XpathLoginButton,
  XpathRadioToCheck)

Arguments

Browser

object, phatomjs web driver use run_browser function to create this object.

LoginURL

character, login page URL

LoginCredentials,

login Credentials values eg: email and password

cssLoginFields,

vector of login fields css pattern.

cssLoginButton,

the css pattern of the login button that should be clicked to access protected zone.

cssRadioToCheck,

the radio/checkbox css pattern to be checked(if exist)

XpathLoginFields,

vector of login fields xpath pattern.

XpathLoginButton,

the xpath pattern of the login button.

XpathRadioToCheck

the radio/checkbox xpath pattern to be checked(if exist)

Value

return authentified browser session object

Author(s)

salim khalil

Examples

 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## Not run: 


 #This function is based on web browser automation, so, before start,
 make sure you have successfully installed web driver (phantomjs).
 install_browser()
 # Run browser process and get its reference object
 br<- run_browser()

  brs<-LoginSession(Browser = br, LoginURL = 'http://glofile.com/wp-login.php',
                LoginCredentials = c('demo','rc@pass@r'),
                cssLoginFields =c('#user_login', '#user_pass'),
                cssLoginButton='#wp-submit' )

 # To make sure that you have been successfully authenticated
 # Check URL of the current page after login redirection
 brs$getUrl()
 # Or Take screenshot of the website dashborad
 brs$takeScreenshot(file = "sc.png")


 brs$delete()
 brs$status()
 brs$go(url)
 brs$getUrl()
 brs$goBack()
 brs$goForward()
 brs$refresh()
 brs$getTitle()
 brs$getSource()
 brs$takeScreenshot(file = NULL)
 brs$findElement(css = NULL, linkText = NULL,
              partialLinkText = NULL, xpath = NULL)
 brs$findElements(css = NULL, linkText = NULL,
               partialLinkText = NULL, xpath = NULL)
 brs$executeScript(script, ...)
 brs$executeScriptAsync(script, ...)
 brs$setTimeout(script = NULL, pageLoad = NULL, implicit = NULL)
 brs$moveMouseTo(xoffset = 0, yoffset = 0)
 brs$click(button = c("left", "middle", "right"))
 brs$doubleClick(button = c("left", "middle", "right"))
 brs$mouseButtonDown(button = c("left", "middle", "right"))
 brs$mouseButtonUp(button = c("left", "middle", "right"))
 brs$readLog(type = c("browser", "har"))
 brs$getLogTypes()


## End(Not run)

Rcrawler documentation built on May 2, 2019, 3:42 a.m.