selenium-chromedriver

Selenium Webdriver in Python - files download directory change in Chrome preferences

时光毁灭记忆、已成空白 提交于 2019-12-27 22:13:18
问题 I'm using Selenium Webdriver (in Python) to automate the downloading of thousands of files. I want to set Chrome's download folder programmatically. After reading this, I tried this: chromepath = '/Users/thiagomarzagao/Desktop/searchcode/chromedriver' desired_caps = {'prefs': {'download': {'default_directory': '/Users/thiagomarzagao/Desktop/downloaded_files/'}}} driver = webdriver.Chrome(executable_path = chromepath, desired_capabilities = desired_caps) No good. Downloads still go to the

Error Message: 'chromedriver' executable needs to be PATH

流过昼夜 提交于 2019-12-27 12:07:27
问题 I just started on Selenium and was able to load up google but now when I run the following code it produces the error: selenium.common.exceptions.WebDriverException: Message 'chromedriver' executable needs to be PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home Why is it saying "C:Users/Colin/Python/chromedriver" is not a path? from selenium import webdriver browser = webdriver.Chrome("C:Users/Colin/Python/chromedriver") browser.get('http://www.google.com') browser

Reload DOM element in selenium webdriver after some new tag added [duplicate]

余生颓废 提交于 2019-12-25 18:48:13
问题 This question already has answers here : Unable to find_element_by_id when element is created via execute_script (2 answers) Closed 11 months ago . In my web page, when I click OK button, some HTML tag will be added in current page source for display popup (the URL is not changed). How can I get new web element from current page? 回答1: You can use explicit wait to wait for the element to be added to the DOM WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.until

All open Chrome windows using Selenium Chrome driver

旧城冷巷雨未停 提交于 2019-12-25 18:34:02
问题 How do I identify an existing open Chrome Window with a specific url in its address bar, and open a new tab in that window using Selenium web driver in C#? All examples I see shows how to open new tabs in a window that is opened within Selenium ChromeDriver. IWebDriver driver = null; var chromeDriverService = ChromeDriverService.CreateDefaultService(); chromeDriverService.HideCommandPromptWindow = true; driver = new ChromeDriver(chromeDriverService); List<string> tabs = new List<string>

Get real XML source in Selenium Chrome Driver

你说的曾经没有我的故事 提交于 2019-12-25 18:24:06
问题 I am using selenium and ChromeDriver to test a XML response. The response is like this: <?xml version="1.0" encoding="UTF-8"?> <d>test</d> But If I get that URL in selenium, chrome will render the XML automatically, making the page_source dirty. >>> from selenium import webdriver >>> b=webdriver.Chrome() >>> b.get('http://127.0.0.1/test.xml') >>> b.page_source '<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"><head><style id="xml-viewer-style">/* Copyright 2014

Though Xpath is available, element not found error is thrown

依然范特西╮ 提交于 2019-12-25 17:59:26
问题 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- saved from url=(0078)http://ussbyintv8057.acetst.com/Enterprise_CRS/CAT06/newquote/FindAccount.aspx --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"> <title>Account Search</title> <link href="./ACE(2).css" type="text/css" rel="stylesheet"> <script language="javascript" src=".

Google Chrome command line switch to emulate a device size?

丶灬走出姿态 提交于 2019-12-25 11:42:49
问题 Does anyone know what are the Google Chrome command line switches that I can use to emulate the device size? The component that I want to test contains the CSS @media query min-device-width/min-device-height. I tried using the --window-size and --user-agent but I have no luck with those. Basically, I am trying to write a webdriver test for this component. 回答1: Regular Chrome does not really support this function, but Chrome Canary is exactly what you are looking for. https://www.google.com

How to check whether the page loaded with the correct url and tab title

丶灬走出姿态 提交于 2019-12-25 09:16:02
问题 I wrote a method to load the page navigation links. The method works, but when I added code to check the correct URL and tab title my test is not performed. Sometimes it happens that for loop fast clicks on the pages the side that does not get loaded, I do not know whether it is a problem but I can not check whether a page loaded with the correct url or tab title, or the problem is the code that I wrote for check the correct url or tab title. This is my method: public void showNavigationLinks

Protractor throws error an X Display is required for headless chrome 59

血红的双手。 提交于 2019-12-25 08:42:19
问题 While running ng e2e I get the following ✓ should display message saying sign up ✗ should be able to sign up with a valid user - Failed: unknown error: an X display is required for keycode conversions, consider using Xvfb (Session info: headless chrome=59.0.3071.71) (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.13.0-48-generic x86_64) (Session info: headless chrome=59.0.3071.71) (Driver info: chromedriver=2.29.461571

How to run Selenium WebDriver test cases in Chrome with Maven?

拥有回忆 提交于 2019-12-25 08:18:05
问题 I need to create simple autotest using ChromeDriver with Maven. excerpt from pom.xml: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.53.1</version> </dependency> test case: @BeforeTest public void StartBrowser_NavURL() { driver = new ChromeDriver(); driver.manage().window().maximize(); } @AfterTest public void CloseBrowser() { driver.quit(); } @Test public void testToCompareDoubles() { driver.get("http://www.google.com"); } And after