selenium-firefoxdriver

How to continue webdriver/selenium after error

不想你离开。 提交于 2020-01-06 04:05:01
问题 I'm doing a test bot with webdriver. I have a scenario where it clicks on a button, a new windows open, and it searches for an element by a specific xpath, but sometimes there is no such element because it can be disabled and i get this error: org.openqa.selenium.NoSuchElementException. How can i bypass it/continue the bot so it just closes the new windows if it doesn't find the element with that xpath and just continue with the code? 回答1: In Java : List<WebElement> foundElement = driver

Browsing context has been discarded using GeckoDriver Firefox through Selenium

折月煮酒 提交于 2019-12-31 00:56:07
问题 I didn't make any changes to my python selenium program and it worked fine 3 days ago. Now when i try to use it i get: Browsing context has been discarded Failed to decode response from marionette Any idea what could have caused this outside the code? (since no changes were made) I'm using firefox and geckodriver. After i got these errors i updated firefox, geckodriver, and selenium, but it didn't help. 回答1: This error message... Browsing context has been discarded . Failed to decode response

Export as PDF using Selenium Webdriver Screenshot

北城以北 提交于 2019-12-29 06:57:13
问题 Does anyone know if it's possible to export HTML to PDF using the screenshot feature in Selenium Firefox WebDriver? I have a webpage which has print specific css which I need to download automatically. I understand that the screenshot feature takes a screenshot of the page as an image, but I was looking for a scalable PDF file which is good for print. 回答1: Screenshots in Selenium are saved as PNG. And PNG and PDF are different kind of formats. So Selenium cannot save your HTML page image

What are the benefits of using Marionette FirefoxDriver instead of the old Selenium FirefoxDriver for a Selenium tester?

笑着哭i 提交于 2019-12-28 03:51:09
问题 Last weeks there has been a lot of noise about this new FirefoxDriver called Marionette. To use Firefox with Selenium, we used to use the "old" Selenium FirefoxDriver. From Firefox 48.0 onwards it is going to be required to use this new FirefoxDriver developed by Mozilla. I understand it is required to change to that direction to get every browser supports and develops its drivers and to get drivers independent of Selenium. Besides, it is supposed if Mozilla develops its own driver, it will

How do I recover the “text” from the page originating the alert, esp **after** the human user has *clicked* [dismiss] on the page's **alert**?

筅森魡賤 提交于 2019-12-28 01:39:27
问题 Basically, when an alert is popped up in javascript, I can dismiss() it from python perfectly OK, by calling selenium.webdriver.common.alert.Alert(browser).dismiss() . However, if the "browser user" dismisses the alert by clicking [OK] (on screen) with their mouse, then the browser alert gets "Lost in Space" the body.text can no longer be accessed from python. So... How do I recover the "text" from the page originating the alert, esp after the human user has clicked [dismiss] on the page's

Filling out form with Selenium works on Chrome but not Firefox

牧云@^-^@ 提交于 2019-12-24 21:45:07
问题 I'm trying to fill out a textarea using Selenium and ruby in Firefox, but for some reason, the code below doesn't work. When I switch the same script to Chrome driver though, it does work. browser.textarea(:placeholder => "Add a comment…").set "#{randomly_chosen_comment}" On firefox, I get this error: /Users/miajohansson/.rvm/gems/ruby-2.2.4/gems/watir-6.10.3/lib/watir/elements/element.rb:623:in `raise_present': element located, but timed out after 30 seconds, waiting for #<Watir::TextArea:

Selenium WebDriver, Firefox, Centos, unable to find a matching set of capabilities

吃可爱长大的小学妹 提交于 2019-12-24 20:57:15
问题 I have an application that uses Selenium WebDriver to control FireFox. It runs as a Web Application under Tomcat - yes, this is a bit of an odd architecture, but there are good reasons for doing this. I've been testing this on my MacBook and it's been working well. My code calls WebDriver, WebDriver calls gecko, Firefox runs, all is good. I now move to a Centos-7 box, and hit a problem org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities Build info:

Selenium Actions.movetoElement - org.openqa.selenium.UnsupportedCommandException

元气小坏坏 提交于 2019-12-24 07:49:35
问题 I have a scenario where I have to hover over a menu link and click on the drop down sub menus. The code that I'm using is below: public void changeLanguageTest() throws InterruptedException { WebElement LanguageMenu = driver.findElement(By.cssSelector(".change-language>button")); action.moveToElement(LanguageMenu); WebElement mongolianLang = driver.findElement(By.cssSelector(".change-language>ol>li:nth-child(3)>a")); action.moveToElement(mongolianLang).click().build().perform(); Thread.sleep

Is that good to use driver.manage().window().maximize() in selenium for every time we invoke browser

╄→гoц情女王★ 提交于 2019-12-24 01:24:34
问题 We use driver.manage().window().maximize(); to maximize the browser. I have seen few examples online that are using driver.manage().window().maximize() though it's not required to maximize the browser. (For Ex: gmail login) Also I see on invoking browser using selenium it opens in maximized window only. Still I have to use this driver.manage().window().maximize(); 回答1: Short answer: Yes. Little longer answer: when selenium is interacting with the web page, like clicking on button or writing

C# Selenium WebDriver FireFox Profile - using proxy with Authentication

我的梦境 提交于 2019-12-23 09:25:44
问题 When you set proxy server parameter in the code below if your proxy server requires authentication then FireFox will bring Authentication dialog and basically you can't fill it in automatically. So is there is anyway to set USERNAME and PASSWORD ? FirefoxProfile profile = new FirefoxProfile(); String PROXY = "192.168.1.100:8080"; OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy(); proxy.HttpProxy=PROXY; proxy.FtpProxy=PROXY; proxy.SslProxy=PROXY; profile.SetProxyPreferences(proxy);