selenium-chromedriver

chrome modify headers in selenium java, i am able to add extension .crx through script

那年仲夏 提交于 2019-12-04 16:13:19
I am able to add extension(.crx ) through selenium web driver ChromeOptions options = new ChromeOptions(); options.addExtensions(new File("src/main/resources/idgpnmonknjnojddfkpgkljpfnnfcklj.crx")); But unable to add name and value through selenium java. can anyone help me on this? Chrome stores the settings of an extension in the localstorage. So one way to customize your extension is to first set the context on it and then edit the localstorage with a piece of Javascript. Here is an example adding two headers (token1 and token2) to ModHeader: // add the ModHeader extension ChromeOptions

Window defender wants to reset your setting\" -ChromeDriver 2.29 issue:ChromeBrowser opening with a new tab

不想你离开。 提交于 2019-12-04 15:39:34
Chrome Browser open up with a new Tab asking for Window defender wants to reset your setting" Please help me to resolve this issue This is happening in chrome v.57 and chromeDriver 2.29 ,please let me know if any suggestion There are 2 solutions to this: Option A Create a new browser profile. Restart your machine. Option B If option A does not solve the issue, then this problem is caused by a key in the registry with the name, TriggeredReset . Delete this key, but first to be safe create a system restore point. Click on Start, then on Run. (Win + R) Type in regedit and hit return key or click

How to download a HTML webpage using Selenium with python?

*爱你&永不变心* 提交于 2019-12-04 15:22:06
I want to download a webpage using selenium with python. using the following code: from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument('--save-page-as-mhtml') d = DesiredCapabilities.CHROME driver = webdriver.Chrome() driver.get("http://www.yahoo.com") saveas = ActionChains(driver).key_down(Keys.CONTROL)\ .key_down('s').key_up(Keys.CONTROL).key_up('s') saveas.perform() print("done") However the above code isnt working. I am using

Java Selenium Chrome driver - Disable image loading

一笑奈何 提交于 2019-12-04 14:54:57
I am trying to run chrome driver without loading any images for obvious reasons. i found a piece of code online but i think it's outdated HashMap<String, Object> images = new HashMap<String, Object>(); images.put("images", 2); HashMap<String, Object> prefs = new HashMap<String, Object>(); prefs.put("profile.default_content_settings", images); ChromeOptions options =new ChromeOptions(); options.setExperimentalOption("prefs", prefs); DesiredCapabilities chromeCaps = DesiredCapabilities.chrome(); chromeCaps.setCapability(ChromeOptions.CAPABILITY, options); driver = new ChromeDriver(chromeCaps);

Explicit waits in Selenium C# doesn't work . What is wrong?

不问归期 提交于 2019-12-04 14:35:27
So I have this issue with explicit waits. I don't want to use Thread.Sleep(). This is an simple test which it opens a page and then goes back and forward. It takes about 2-3 seconds to load this page and I want to do this in a dynamic way (testing). Hope I am not too confusig. I did a lot of research but nothing works, maybe I am doing something wrong. ( I'm using Resharper to run unit tests) Here I have also the solution: https://www.dropbox.com/s/1k5vjc5czvmdd3u/ConsoleApplication2.rar?dl=0 I am using an extension to FindElement method so I believe it would be easy to just call this method

Handle the NoSuchElementException in Fluent Wait

早过忘川 提交于 2019-12-04 14:15:41
I know that in terms of waiting for web element that isn't in the DOM yet, the most efficient is a fluent wait. So my question is: Is there a way to handle and catch the NoSuchElementException or any exception that fluent wait might throw because the element is not existing? I need to have a boolean method wherein it will give me result whether the element is found or not. This method is quite popular on the web. public void waitForElement(WebDriver driver, final By locator){ Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(60, TimeUnit.SECONDS) .pollingEvery(2, TimeUnit

Is it possible to build a web automation that can run through a browser?

帅比萌擦擦* 提交于 2019-12-04 13:55:48
I have created a Java program that utilizes Chrome Driver , Selenium , and Java Excel API . The program is used to automate a few different processes on Google Chrome. Currently, setting up this automation is more complicated than I would like it to be: the user needs to download a zipped folder, unzip it, download the Java Runtime Environment, and launch the program using the executable. My goal is to simplify the installation of the automation. Ideally, a user would come to a SharePoint website, fill out a form with the parameters of the automation (potentially upload an Excel Workbook),

How to access a site via a headless driver without being denied permission

醉酒当歌 提交于 2019-12-04 12:54:45
I am trying to retrieve the html code of a site using a headless chrome driver. However I get a "permission denied" message. If I use a "regular" driver it all works fine. Is there any way to bypass that? It's my first post so I do apologize for any potential mistakes in formatting from selenium import webdriver #Headless driver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') driver1 = webdriver.Chrome(executable_path='./chromedriver', options=chrome_options, service_args=['--verbose', '--log-path=/tmp

Unexpected Alert Open Error. “browser.switchTo().alert().accept();” works fine in firefox but not in Chrome when running through Jenkins

女生的网名这么多〃 提交于 2019-12-04 12:50:19
How to handle this error in chrome browser using protractor. Chrome driver through's following error: UnexpectedAlertOpenError: unexpected alert open: {Alert text : There are unsaved data, please save before you leave, otherwise your changes get lost!} I have used "browser.switchTo().alert().accept();" but this is not working, works fine in firefox. Please help me, help is greatly appreciated. today, after struggling with this new problem for the past week or so, we found that the problem was fixed by using the latest Protractor version. Changing the package.json to "protractor": "*" did the

WebDriverError error: Chrome failed to start: exited abnormally

天涯浪子 提交于 2019-12-04 11:57:04
I'm trying to run protractor test on ubuntu 14.04 vm (by google cloud), for some reason when i run 'protractor conf.js' i get an error says: E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally I followed this tasks in order to install headless chrome: https://gist.github.com/alonisser/11192482 Before running protractor cons.js, i'm running "webdriver-manager start" When i run 'Xvfb -ac :2 -screen 0 1280x1024x16' its freeze when gets to 'Initializing built-in extension GLX' I also tried change the conf.js to chromeOptions: { args: [ "--headless", "--disable-gpu