selenium-chromedriver

How to perform right click using Selenium ChromeDriver?

…衆ロ難τιáo~ 提交于 2019-12-05 18:02:37
问题 I have been searching for this a lot, but could not find an answer for Python. Is it possible to simulate right click, or open up the context menu via selenium/chromedriver? I have seen options for Java, and some other languages, but never in Python. What would I have to do to simulate a right click on a link, or a picture? 回答1: It's called context_click in selenium.webdriver.common.action_chains. Note that Selenium can't do anything about browser level context menu, so I assume your link

Selenium ChromeDriver - Run in background but not headless

人走茶凉 提交于 2019-12-05 17:47:40
I am looking for a way to run selenium tests with a chrome driver, in the background. With the background I mean as in, not the foreground focussed window. I can actually do this, but as soon as actions like opening a new tab or switching between windows (so basically switching window handles) happen in the chrome driver, the browser window gets pushed to the foreground. So my question is, how can I prevent this from happening without running the test headless? Any suggestions are appreciated, open for discussion. EDIT As a somewhat temporary solution I came up with the following. Using the

ElementNotVisibleException when use headless Chrome browser

霸气de小男生 提交于 2019-12-05 16:43:32
问题 When I run test script in headless mode chrome browser, element link is not visible, is not able to do linkElement.click() . in head mode is everything OK. All other info are in stacktrace. Anyone knows what to do, please? StackTrace: ERROR occurred: Message: element not visible (Session info: headless chrome=60.0.3112.90) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) Traceback (most recent call last): File "C:\nik-x

C# Selenium Start Chrome with Different User Profile

蹲街弑〆低调 提交于 2019-12-05 16:30:48
For the past 2 days, I've been trying to find a way to start Chrome with a different profile but to no avail. No matter what I do, the profile that Selenium loads for chrome is always some temporary profile like "C:\Users\DARKBO~1\AppData\Local\Temp\scoped_dir14308_25046\Default" I have tried the following code: ChromeOptions options = new ChromeOptions(); options.AddArgument(@"user-data-dir=C:\SeleniumProfiles\Default"); IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("chrome://version"); First I tried using the directories for the profiles directly from the Chrome folder,

Selenium.WebDriver - I get error when I try to run my test in Chrome

丶灬走出姿态 提交于 2019-12-05 16:23:55
问题 I get error when I try to run my test in Chrome : Initialization method AutomationUsingSelenium.SmuladorChrome.MyTestInitialize threw exception. OpenQA.Selenium.DriverServiceNotFoundException: OpenQA.Selenium.DriverServiceNotFoundException What is the cause? 回答1: Finally I resolve my issue. 1) I copied chromedriver.exe in Chrom directory link, but you can put in any directory, I decided to put here. 2) I Initialized a new instance of the ChromeDriver class using the specified // path to the

Is it possible to automatically open Google Chrome devtools?

大城市里の小女人 提交于 2019-12-05 14:45:37
问题 Given that Selenium 2 closes the devtools window which contains my emulator profile saved under my user profile for chrome. Is there a way to trigger devtools to open using a selenium script? Here is the info on the devtools window closing issue https://sites.google.com/a/chromium.org/chromedriver/help/devtools-window-keeps-closing I feel a little exhausted trying some of these Chromium override parameters only one of which seems to work http://peter.sh/experiments/chromium-command-line

Run Multiple Instances of ChromeDriver

自古美人都是妖i 提交于 2019-12-05 10:01:30
Using selenium and python I have several tests that need to run in parallel. To avoid using the same browser I added the parameter of using a specific profile directory and user data (see below). The problem is that I cannot run them simultaneously, one test needs to wait for the other to finish. Otherwise I get the following error from chromedriver: Starting ChromeDriver 2.29.461591 (62ebf098771772160f391d75e589dc567915b233) on port 9515 Only local connections are allowed. [0.000][SEVERE]: bind() returned an error: Only one usage of each socket address (protocol/network address/port) is

Automated Chrome hides text in CodeceptJS WebdriverIO test

爱⌒轻易说出口 提交于 2019-12-05 09:43:09
问题 I have a fresh install of Chrome Version 67.0.3396.87 and followed the https://codecept.io/quickstart/ to init a project and create the following test: Feature('Hidden Text'); Scenario('test something', (I) => { I.amOnPage('/'); pause(); }); The codecept.json config is pretty standard: { "tests": "./*_test.js", "timeout": 10000, "output": "./output", "helpers": { "WebDriverIO": { "url": "https://codecept.io", "browser": "chrome" } }, "include": { "I": "./steps_file.js" }, "bootstrap": false,

Selenium/Python - Extract dynamically generated HTML after submitting form

别来无恙 提交于 2019-12-05 06:44:48
The web page I am trying to access is using JavaScript to dynamically generate HTML form(this one: https://imgur.com/a/rhmXB ). When typing print(page_source) , the table seems to appear in the HTML being outputted. However , after filling the input field and submitting the form, another input field with CAPTCHA image appears(as shown here: https://imgur.com/a/xVfBS ). After typing print(page_source) , the input form with the CAPTCHA seems not to be inserted into the HTML. My question is: How can I access this dynamically generated HTML, which contains the input field and the CAPTCHA image

ChromeDriver exception reporting “target window already closed” in headless mode

↘锁芯ラ 提交于 2019-12-05 06:40:45
问题 I am using xUnit, SpecFlow, Selenium and headless Chrome to run automated tests, but every so often I will get a series of crashes when running on localhost when trying to capture a screenshot of the final browser window. There are two scenarios, each in a separate feature file, which means they run in parallel. It appears to be the scenario which starts up second which always fails. Here is how I'm creating my browser instance: private static readonly string UserDataDir = new FileInfo