Skip to content

Commit

Permalink
chore: fix client
Browse files Browse the repository at this point in the history
  • Loading branch information
route committed Feb 18, 2024
1 parent 60d5328 commit dbe79f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/capybara/cuprite/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def close_window(target_id)

@page = nil if @page.target_id == target.id
target.page.close
targets.delete(target_id) # page.close is async, delete target asap
end

def browser_error
Expand Down Expand Up @@ -237,10 +238,10 @@ def prepare_wildcards(patterns)
def attach_page(target_id = nil)
target = targets[target_id] if target_id
target ||= default_context.default_target
return target.page if target.attached?
return target.page if target.connected?

target.maybe_sleep_if_new_window
target.page = Page.new(client, context_id: target.context_id, target_id: target.id)
target.page = Page.new(target.client, context_id: target.context_id, target_id: target.id)
target.page
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/cuprite/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def switch_to_frame(locator)
def open_new_window
target = browser.default_context.create_target
target.maybe_sleep_if_new_window
target.page = Page.new(browser.client, context_id: target.context_id, target_id: target.id)
target.page = Page.new(target.client, context_id: target.context_id, target_id: target.id)
target.page
end

Expand Down

0 comments on commit dbe79f2

Please sign in to comment.