add_recipe_step: Add a new single recipe step

Description Usage Arguments Value See Also Examples

View source: R/add_recipe_step.R

Description

Adds a newly created recipe step to the database. See https://github.com/MarHai/ScrapeBot/blob/master/scrapebot/emulate.py for type descriptions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
add_recipe_step(
  connection,
  recipe_uid,
  type = "log",
  fixed_value = "",
  random_items = c(),
  use_data_item_instead_of_value = FALSE,
  active = TRUE,
  sort = NA_integer_
)

Arguments

connection

A connection object, as retrieved from connect_scrapebot().

recipe_uid

The uid (integer) of the corresponding recipe.

type

The type of what this step should do. Has to be one of the following as character string:

  • click

  • data

  • element_screenshot

  • execute_js

  • find_by_class

  • find_by_css

  • find_by_id

  • find_by_link

  • find_by_link_partial

  • find_by_name

  • find_by_tag

  • find_by_xpath

  • get_attribute

  • get_attributes

  • get_element_count

  • get_htmlsource

  • get_pagetitle

  • get_text

  • get_texts

  • get_value

  • get_values

  • go_back

  • go_forward

  • log

  • navigate

  • pause

  • post_all_data

  • post_previous_step_data

  • random_select

  • screenshot

  • scroll_to

  • sometimes_screenshot

  • submit

  • unset_prior_element

  • write

  • write_slowly

fixed_value

Possibly required value (depends on type); default is an empty character string.

random_items

Character vector to be used as urn to draw random items for fixed_value from.

use_data_item_instead_of_value

Logical indicating whether value should be taken from a previous data item. If TRUE, fixed_value needs to be set accordingly.

active

Boolean to indicate whether the recipe step should be active; default is TRUE.

sort

Numeric index to have steps be run one after another. If NA, new step is appended to the end.

Value

The uid (integer) of the newly created recipe step or an integer NA in case of error.

See Also

add_recipe(), get_recipes(), get_recipe_steps()

Examples

1
2
3
4
5
6
7
8
9
## Not run: 

connection <- connect('my_db on localhost')
recipe_uid <- add_recipe(connection, 'visit my website')
add_recipe_step(connection, recipe_uid, 'navigate', 'https://www.google.com/')
add_recipe_step(connection, recipe_uid, 'screenshot')
disconnect(connection)

## End(Not run)

MarHai/ScrapeBotR documentation built on March 10, 2021, 10:10 a.m.