selenium-chromedriver

How to fix selenium “DevToolsActivePort file doesn't exist” exception in Python [duplicate]

跟風遠走 提交于 2020-02-29 04:13:51
问题 This question already has answers here : WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser (21 answers) Closed 8 months ago . When I use both arguments --headless and user-data-dir . Selenium raise selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist exception. If only 1 of them is used, then everything works as needs. I tried to swap arguments and remove some of them.

Selenium webdriver not opening websites in default chrome profile

懵懂的女人 提交于 2020-02-28 23:17:32
问题 I have tried selenium webdriver in Python and it works fine. But when I try to open default chrome profile it doesn't open the websites. The code is chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument("user-data- dir=/Users/prajwal/Library/Application Support/Google/Chrome") capability = DesiredCapabilities.CHROME capability["pageLoadStrategy"] = "normal" driver = webdriver.Chrome(desired_capabilities=capability, chrome_options=chromeOptions) driver.get("https://www.google

How to execute class in logged in slenium instead of opening new chrome instance?

核能气质少年 提交于 2020-02-25 22:42:29
问题 from selenium import webdriver from time import sleep filename = "log.txt" myfile = open(filename, 'w') class Search(object): def __init__(self): self.driver = webdriver.Chrome('chromedriver.exe') # "This will open a new chrome instance without being logged in to the site" self.driver.get("Site2") sleep(2) self.driver.find_element_by_xpath("/html/body/div[1]/div[4]/div/div/div[3]/div/div/div[2]/div[2]/div[2]/div/div[4]/div[1]/div[2]/div[1]/a").click() sleep(2) Texto = self.driver.find_element

“Message=unknown error: cannot focus element” while executing tests through Selenium, ChromeDriver and Chrome

情到浓时终转凉″ 提交于 2020-02-25 04:30:10
问题 I am trying to send key for a drop down list in google chrome browser but i am receiving this error OpenQA.Selenium.WebDriverException HResult=0x80131500 Message=unknown error: cannot focus element (Session info: chrome=68.0.3440.106) (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64) Source=WebDriver StackTrace: at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium

“Message=unknown error: cannot focus element” while executing tests through Selenium, ChromeDriver and Chrome

陌路散爱 提交于 2020-02-25 04:30:05
问题 I am trying to send key for a drop down list in google chrome browser but i am receiving this error OpenQA.Selenium.WebDriverException HResult=0x80131500 Message=unknown error: cannot focus element (Session info: chrome=68.0.3440.106) (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64) Source=WebDriver StackTrace: at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium

How to Wait for an Alert in Selenium WebDriver with C#?

无人久伴 提交于 2020-02-23 08:26:25
问题 How can i set Selenium WebDriver to Wait for an Alert before accepting it instead of Thread.Sleep? As website, sometimes loads very slowly or sometimes fast. Thanks 回答1: You should apply webdriver wait for an alert to be present properly. new WebDriverWait(driver, TimeSpan.FromSeconds(15)); wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.AlertIsPresent()); OR write a boolean function to check alert present and use it for wait bool IsAlertShown(WebDriver driver) { try { driver

How to remove Scrollbar in ChromeDriver, how to change http-agent?

ⅰ亾dé卋堺 提交于 2020-02-21 13:17:18
问题 I use IWebDriver driver = new ChromeDriver(options) in C# When I take .GetScreenshot(); , often see scrollbar, is there a way to remove it? 2nd question, how to mock/change http_agent in ChromeDriver? 回答1: Scrollbar issue: Try using Chrome switches when starting webdriver. See http://peter.sh/experiments/chromium-command-line-switches/ or chrome://flags/ in Chrome. You can also make Chromedriver open the url in a popup without scrollbars. You can do this using some Javascript. Or you could

How to remove Scrollbar in ChromeDriver, how to change http-agent?

半世苍凉 提交于 2020-02-21 13:11:41
问题 I use IWebDriver driver = new ChromeDriver(options) in C# When I take .GetScreenshot(); , often see scrollbar, is there a way to remove it? 2nd question, how to mock/change http_agent in ChromeDriver? 回答1: Scrollbar issue: Try using Chrome switches when starting webdriver. See http://peter.sh/experiments/chromium-command-line-switches/ or chrome://flags/ in Chrome. You can also make Chromedriver open the url in a popup without scrollbars. You can do this using some Javascript. Or you could

How to remove Scrollbar in ChromeDriver, how to change http-agent?

浪子不回头ぞ 提交于 2020-02-21 13:11:14
问题 I use IWebDriver driver = new ChromeDriver(options) in C# When I take .GetScreenshot(); , often see scrollbar, is there a way to remove it? 2nd question, how to mock/change http_agent in ChromeDriver? 回答1: Scrollbar issue: Try using Chrome switches when starting webdriver. See http://peter.sh/experiments/chromium-command-line-switches/ or chrome://flags/ in Chrome. You can also make Chromedriver open the url in a popup without scrollbars. You can do this using some Javascript. Or you could

Selenium webdriver.Remote driver does not work with tor proxy(webdriver.Chrome does)

瘦欲@ 提交于 2020-02-21 03:02:50
问题 I'm trying to use socks5 proxy on my remote driver which is hosted as a docker container on port 4444. here is code-sample: from selenium import webdriver opts = webdriver.ChromeOptions() opts.add_argument("--no-sandbox") opts.add_argument("--disable-dev-shm-usage") opts.add_argument("--proxy-server=socks5://127.0.0.1:9050") driver = webdriver.Remote(command_executor="http://localhost:4444/wd/hub", desired_capabilities=opts.to_capabilities()) Then, when I try to open any page, I get error