webdriverwait

How to properly configure Implicit / Explicit Waits and pageLoadTimeout through Selenium?

Deadly 提交于 2019-11-27 05:42:07
I currently have the following setup, but I'm not sure that my waits (Implicit and pageLoadTimeout) are working. Is this the proper implementation? By putting it in the @Before("@setup"), does it work for every Scenario or Step Definition run? Will the driver wait accordingly, everytime I call a @Given, @When..etc? @Before("@setup") public void setUp() { driver.manage().deleteAllCookies(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS); } Why is it necessary to assign a WebElement to the following wait , what

How to combine implicit and explicit timeouts in Selenium?

▼魔方 西西 提交于 2019-11-26 23:42:00
问题 I am using Selenium ChromeDriver with an implicit timeout: _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); In one of my tests I want to override this with an explicit timeout. Before reading a property I explicitely wait for the element to be found: WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(120)); wait.Until(d => d.FindElement(By.CssSelector("div.example"))); I would expect this to take 120s to try to find the element, but it times out after just

getWindowHandles() not working in firefox 58.The focus remains on parent tab and does not transfer to next tab

喜夏-厌秋 提交于 2019-11-26 23:20:07
I am starting to learn how to handle multiple tabs in a browser using Selenium with Java. looks like my code below is not working. import java.util.ArrayList; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class HandlingWindows { public static void main(String[] args) throws InterruptedException { WebDriver driver= new FirefoxDriver(); driver.get("https://www.facebook.com/"); String parent= driver.getWindowHandle(); System.out.println("Parent Window is"+parent); //Get Data

Message: Element <option> could not be scrolled into view while trying to click on an option within a dropdown menu through Selenium

僤鯓⒐⒋嵵緔 提交于 2019-11-26 23:19:56
I am trying to select a drop down menu and choose an option. I am using the latest version of Selenium, the latest version of Firefox, the latest version of geckodriver, and the latest version of Python. Here is my issue: When I try to choose an option, it gives me the following error: selenium.common.exceptions.ElementNotInteractableException: Message: Element <option> could not be scrolled into view. I have tried various ways to circumnavigate this issue, but none seem to work. Here are some of the approaches I tried. mySelectElement = browser.find_element_by_id('providerTypeDropDown')

Selenium Switch Tabs

折月煮酒 提交于 2019-11-26 23:07:26
Since Firefox does not support Control + T anymore for the tab, I started using driver.execute_script("window.open('URL', 'new_window')") I am trying to display the title of the different tab I open and switch between them. For the example below, I expect the output to be facebook, google and back to facebook. Right now the output is facebook, facebook and facebook. I tried the answer from here but it also did not work: Switch back to parent tab using selenium webdriver from selenium import webdriver driver = webdriver.Firefox() driver.get("http://www.facebook.com/") print(driver.title) driver

ElementNotInteractableException: Message: element not interactable error while sending text to Email field on Quora using Selenium with Python

青春壹個敷衍的年華 提交于 2019-11-26 22:11:11
问题 Here is my code: from selenium import webdriver user = "someemail@email.com" browser = webdriver.Chrome("/path/to/browser/") browser.get("https://www.quora.com/") username = browser.find_element_by_name("email") browser.implicitly_wait(10) username.send_keys(user) Here is the error message: selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable I think there is another thread with a similar issue. Either the solutions in that thread didn't work for me or

selenium.common.exceptions.ElementNotVisibleException: Message: element not visible while trying to access an element with Python + Selenium

半城伤御伤魂 提交于 2019-11-26 22:10:24
问题 I am trying to enter username and password in the following website: https://www.thegreatcoursesplus.com/sign-in driver = webdriver.Chrome() driver.get('https://www.TheGreatCoursesPlus.com/sign-in') driver.find_element_by_xpath('//h1[@class="sign-in-input"]').click() This gave following exception: selenium.common.exceptions.ElementNotVisibleException: Message: element not visible Then I tried to use java script: driver.execute_script("document.getElementsByClassName('sign-in-input')[0].click(

Selenium Webdriver - Stale element exception when clicking on multiple dropdowns while HTML DOM doesn't change

◇◆丶佛笑我妖孽 提交于 2019-11-26 18:38:43
问题 I tried to automate a scenario, where the condition is that I have to select an option from drop down and then there's another dropown next to it, I have to click one option from next drop to enable to button . I tried with the code but it clicks only the first option,.And showing error as stale Element reference:element is not attached to the page document. Please help. Please let me know if in not very clear. 回答1: When you select Insurance Test Client then only you get the option Product

Unable to locate SVG elements through xpath on Kendo UI chart

给你一囗甜甜゛ 提交于 2019-11-26 18:38:32
问题 I did try some of xpaths but seems no luck. I want to click on country and then graph , Given below screenshot : Website URL is : https://demos.telerik.com/kendo-ui/bar-charts/column I tried xpaths : //text(text()='India') //g//text(text()='India') 回答1: As the desired elements are SVG Elements you need to consider the namespace and induce WebDriverWait for the desired element to be clickable and to click on the first bar within the graph you can use the following solution: Code Block: from

selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium

狂风中的少年 提交于 2019-11-26 18:01:34
I am searching to do a program for fun but i have some problems with selenium and i need some help... This is the programm (i deleted the directory of webdriver because the folder's name contain the name of an other person) from selenium import webdriver import webbrowser import time def Pass_send_(): driver=webdriver.Chrome() driver.get('chrome://flags/#password_export-enable') ricerca=driver.find_element_by_id("search") ricerca.send_keys('password export') scorritore=driver.find_element_by_class_name('experiment-select') scorritore.click() Pass_send_() And so the purpose it's easy, it should