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
|
# File 'lib/headless_browser_tool/tools/drag_tool.rb', line 16
def execute(source_selector:, target_selector:)
source = browser.find(source_selector)
target = browser.find(target_selector)
source_info = {
tag_name: source.tag_name,
text: source.text.strip,
id: source[:id],
class: source[:class]
}.compact
target_info = {
tag_name: target.tag_name,
text: target.text.strip,
id: target[:id],
class: target[:class]
}.compact
browser.drag(source_selector, target_selector)
{
source_selector: source_selector,
target_selector: target_selector,
source: source_info,
target: target_info,
status: "dragged"
}
end
|