Using Zyte with Selenium?

Posted over 3 years ago by d2clon

Post a topic
Un Answered
d
d2clon

I am using this Ruby scrip to test Zyte with Selenium:


(Selenium Version: 4.0.0.beta2)

 

   

proxy = Selenium::WebDriver::Proxy.new(http: "API_KEY:@proxy.crawlera.com:8011")
cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
driver = Selenium::WebDriver.for(:chrome, capabilities: cap)
driver.navigate.to("http://httpbin.org/ip")
puts "content: #{driver.page_source}"
driver.close

  

 But it is returning my ip instead of the proxy IP


If I use another proxy (without authentication) I get the proper proxy IP:


 

proxy = Selenium::WebDriver::Proxy.new(http: "185.235.41.85:80")
cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
driver = Selenium::WebDriver.for(:chrome, capabilities: cap)
driver.navigate.to("http://httpbin.org/ip")
puts "content: #{driver.page_source}"
driver.close

 Result: 

  

{
  "origin": "185.235.41.85"
} 

  

0 Votes


1 Comments

d

d2clon posted over 3 years ago

The only way I found to make it possible is using the crawlera-headless-proxy:


https://docs.zyte.com/smart-proxy-manager/integrations/selenium.html


Here is some example configuration if you have problems with ssl:


https://support.zyte.com/support/discussions/topics/22000014124?page=1

0 Votes

Login to post a comment