Conclusion
In this manual, we described solving several types of captchas in Python, JavaScript and C#, and provided real code examples for the interaction of Selenium and CapMonster Cloud. All examples include the ProxyLess method, that is, we solved all captchas without a proxy. If you need this function, you should visit the documentation, find the type of captcha you need to solve, and create a task request according to the example from the documentation. As an alternative, if it matches your configuration, you can add your proxy parameters in a “.env” file and specify their use in the code. Or you can add its values in the web driver settings.
Python example:
from selenium import webdriver
proxy = "your_proxy_address:port"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=http://' + proxy)
// Other settings options
driver = webdriver.Chrome(chrome_options=chrome_options)
// Your code
driver.quit()
JavaScript example:
const {Builder} = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
let proxy = require('selenium-webdriver/proxy');
let options = new chrome.Options();
options.addArguments(`--proxy-server=http://your_proxy_address:port`);
// Other settings options
let driver = new Builder().forBrowser('chrome').setChromeOptions(options).build();
// Your code
driver.quit();
C# example:
var options = new ChromeOptions();
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--proxy-server=http://your-proxy-server-address:port");
// Other settings options
Note: We'd like to remind you that the product is used to automate testing on your own websites and on websites to which you have legal access.