Selenium block requests, scripts before page loaded
The solution is:
https://chrome.google.com/webstore/detail/http-request-blocker/eckpjmeijpoipmldfbckahppeonkoeko?hl=en
edit and install an extension like this. This can be a solution for request blocking.
Automate Chrome Extensions With Selenium and Ruby
To launch Chrome with the default profile on Windows:
require 'selenium-webdriver'
switches = ['user-data-dir='+ENV['LOCALAPPDATA']+'\\Google\\Chrome\\User Data']
driver = Selenium::WebDriver.for :chrome, :switches => switches
driver.navigate.to "https://www.google.co.uk"
Or to add an extension to the created profile:
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :chrome,
:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome({
'chromeOptions' => {
'extensions' => [
Base64.strict_encode64(File.open('C:\\App\\extension.crx', 'rb').read)
]
}
})
driver.navigate.to "https://www.google.co.uk"
Is there a method of automating the process of downloading the latest Chrome Driver for a Selenium project?
please find below answer :
use below command to install webdriver manager
pip install webdriver_manager
**Use with Chrome:**
from webdriver_manager.chrome import ChromeDriverManager
webdriver.Chrome(ChromeDriverManager().install())
for more details please find below link::
https://github.com/SergeyPirogov/webdriver_manager
Related Topics
How to Check to See If My Array Includes an Object
Do Ruby 'Require' Statements Go Inside or Outside the Class Definition
Running into Smtp Error When Trying to Send Email in Ror App
Google Maps, Ruby on Rails, Zoom Level with One Marker
How to Map/Collect with Index in Ruby
How to Return Early from a Rake Task
Bundler Cannot Install Any Gems Without Sudo
Dynamically Load Google Maps Markers with Gmaps4Rails
Differencebetween Integer and Fixnum
Confusion About Passing Instance Variables to Redirect_To Method. as Seen in Rails Guides
Is It Possible for Rspec to Expect Change in Two Tables
Why Many People Use "-%>" Instead of "%>" in Rails
Node.Js Not Found by Rails/Execjs
Update Just One Gem with Bundler