SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.77k stars 8.02k forks source link

[🚀 Feature]: Implement high level BiDi navigation commands #14208

Open titusfortner opened 5 days ago

titusfortner commented 5 days ago

Feature and motivation

This comes from this discussion

We want to be able to allow users to set listeners on navigation commands to get context information that can be used in logging.

I think we would only need to support this for now? Would it make sense to put it in navigate class with the other commands? 7.3.4.4The browsingContext.fragmentNavigated Event

Usage example

driver.navigate.add_navigated_handler { |event|
  @watch_context = event.context if event.url.include?(whatever) 
}
driver.script.add_console_message_handler { |event|
  log_messages << event.text if event.source["context"] == @watch_context
}
driver.get(my_url)