Class: Charai::BrowsingContext::Realm
- Inherits:
-
Object
- Object
- Charai::BrowsingContext::Realm
- Defined in:
- lib/charai/browsing_context.rb
Defined Under Namespace
Classes: ScriptEvaluationError
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(browsing_context:, id:, origin:, type: nil) ⇒ Realm
constructor
A new instance of Realm.
- #script_evaluate(expression) ⇒ Object
Constructor Details
#initialize(browsing_context:, id:, origin:, type: nil) ⇒ Realm
Returns a new instance of Realm.
127 128 129 130 131 132 |
# File 'lib/charai/browsing_context.rb', line 127 def initialize(browsing_context:, id:, origin:, type: nil) @browsing_context = browsing_context @id = id @origin = origin @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
150 151 152 |
# File 'lib/charai/browsing_context.rb', line 150 def type @type end |
Instance Method Details
#script_evaluate(expression) ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/charai/browsing_context.rb', line 136 def script_evaluate(expression) result = @browsing_context.send(:bidi_call_async, 'script.evaluate', { expression: expression, target: { realm: @id }, awaitPromise: true, }).value! if result['type'] == 'exception' raise ScriptEvaluationError, result['exceptionDetails']['text'] end deserialize(result['result']) end |