Class: Puppeteer::ExecutionContext
- Inherits:
-
Object
- Object
- Puppeteer::ExecutionContext
- Includes:
- IfPresent
- Defined in:
- lib/puppeteer/execution_context.rb
Defined Under Namespace
Classes: EvaluationError, JavaScriptExpression, JavaScriptFunction
Constant Summary collapse
- EVALUATION_SCRIPT_URL =
'__puppeteer_evaluation_script__'- SOURCE_URL_REGEX =
/^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
-
#_context_id ⇒ Object
only used in DomWorld#delete_context.
- #evaluate(page_function, *args) ⇒ Object
- #evaluate_handle(page_function, *args) ⇒ Puppeteer::JSHandle
- #frame ⇒ Puppeteer::Frame
-
#initialize(client, context_payload, world) ⇒ ExecutionContext
constructor
A new instance of ExecutionContext.
Methods included from IfPresent
Constructor Details
#initialize(client, context_payload, world) ⇒ ExecutionContext
11 12 13 14 15 |
# File 'lib/puppeteer/execution_context.rb', line 11 def initialize(client, context_payload, world) @client = client @world = world @context_id = context_payload['id'] end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
17 18 19 |
# File 'lib/puppeteer/execution_context.rb', line 17 def client @client end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
17 18 19 |
# File 'lib/puppeteer/execution_context.rb', line 17 def world @world end |
Instance Method Details
#_context_id ⇒ Object
only used in DomWorld#delete_context
20 21 22 |
# File 'lib/puppeteer/execution_context.rb', line 20 def _context_id @context_id end |
#evaluate(page_function, *args) ⇒ Object
33 34 35 |
# File 'lib/puppeteer/execution_context.rb', line 33 def evaluate(page_function, *args) evaluate_internal(true, page_function, *args) end |
#evaluate_handle(page_function, *args) ⇒ Puppeteer::JSHandle
39 40 41 |
# File 'lib/puppeteer/execution_context.rb', line 39 def evaluate_handle(page_function, *args) evaluate_internal(false, page_function, *args) end |
#frame ⇒ Puppeteer::Frame
25 26 27 28 29 |
# File 'lib/puppeteer/execution_context.rb', line 25 def frame if_present(@world) do |world| world.frame end end |