Class: E2E::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/e2e/element.rb

Instance Method Summary collapse

Constructor Details

#initialize(locator) ⇒ Element

Returns a new instance of Element.



5
6
7
# File 'lib/e2e/element.rb', line 5

def initialize(locator)
  @locator = locator
end

Instance Method Details

#[](attribute) ⇒ Object



25
26
27
# File 'lib/e2e/element.rb', line 25

def [](attribute)
  @locator.get_attribute(attribute)
end

#checked?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/e2e/element.rb', line 41

def checked?
  @locator.checked?
end

#classesObject



29
30
31
# File 'lib/e2e/element.rb', line 29

def classes
  (self["class"] || "").split
end

#clickObject



9
10
11
# File 'lib/e2e/element.rb', line 9

def click
  @locator.click
end

#disabled?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/e2e/element.rb', line 45

def disabled?
  @locator.disabled?
end

#enabled?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/e2e/element.rb', line 49

def enabled?
  @locator.enabled?
end

#fill(value) ⇒ Object



13
14
15
# File 'lib/e2e/element.rb', line 13

def fill(value)
  @locator.fill(value)
end

#has_class?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/e2e/element.rb', line 33

def has_class?(class_name)
  classes.include?(class_name.to_s)
end

#nativeObject

Allows calling native playwright methods if needed



54
55
56
# File 'lib/e2e/element.rb', line 54

def native
  @locator
end

#textObject



17
18
19
# File 'lib/e2e/element.rb', line 17

def text
  @locator.inner_text
end

#valueObject



37
38
39
# File 'lib/e2e/element.rb', line 37

def value
  @locator.input_value
end

#visible?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/e2e/element.rb', line 21

def visible?
  @locator.visible?
end