webdriverwait

How to Check If 100% Covered WebElement is Clickable with Selenium

[亡魂溺海] 提交于 2019-12-02 03:11:50
问题 I have two divs with absolute position <div id="4711" style="position:absolute;top:0px;bottom:0px;left:0px;right:0px;background-color:red">Visible later</div> <div id="4712" style="position:absolute;top:0px;bottom:0px;left:0px;right:0px;background-color:green">To be removed</div> and some Javascript (not shown here) that removes 4712 after a while (lets say after 2 seconds) from the DOM. Now, in my Selenium tests I want to check if 4711 is clickable. From a user's perspective it is only

Unable to locate the child iframe element which is within the parent iframe through Selenium in Java

牧云@^-^@ 提交于 2019-12-02 02:54:55
So far, this is what I have: I've switched the frame to its parent frame then to the the frame I am unable to locate: By frame = By.xpath("//iframe[@class='GenCss_style-Model']"); driver.switchTo().frame(driver.findElement(By.name("documentflowdesk"))); driver.switchTo().frame(driver.findElement(frame)); Since 'frame' element is not found, I get this error: org.openqa.selenium.NoSuchElementException: Unable to locate element HTML: <iframe src="about:blank" name="documentflowdesk" class="gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame" id="documentflowdesk" style="position:

How to increase the execution speed through Selenium and Webdriver

萝らか妹 提交于 2019-12-02 00:16:44
Test is very slow during execution of the script without knowing the reason. This is my script : driver.Navigate().GoToUrl(url); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20); driver.FindElement(By.LinkText("Register Here")).Click(); new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until( SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated( (By.XPath("//div[@class='loader-wrapper ng-trigger ng-trigger-visibilityChanged ng-animating']")))); driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Organization Type'])[2]

How to Check If 100% Covered WebElement is Clickable with Selenium

时光总嘲笑我的痴心妄想 提交于 2019-12-01 23:46:43
I have two divs with absolute position <div id="4711" style="position:absolute;top:0px;bottom:0px;left:0px;right:0px;background-color:red">Visible later</div> <div id="4712" style="position:absolute;top:0px;bottom:0px;left:0px;right:0px;background-color:green">To be removed</div> and some Javascript (not shown here) that removes 4712 after a while (lets say after 2 seconds) from the DOM. Now, in my Selenium tests I want to check if 4711 is clickable. From a user's perspective it is only clickable after 4712 has been removed. So I tried new WebDriverWait(browserInstance.getWebDriver(), 5).until

How to extract the dynamic values of the id attributes of the table elements using Selenium and Java

久未见 提交于 2019-12-01 19:36:11
I have a table where each row will have a download link with a (partly) auto-generated id element. The reason for this is that the actual href-element will allways be "#", so the id's separate the downloads. I need to find the name of that id element in the td. That is: I know the table row has an id element, and I know part of the name, and I need to get the exact name. I'm accessing each row one at a time, so I only need to look within ONE td at a time. No need to look through the whole table. I know well how to find an element when I know the name. But to find the element when I only know

no such element: Unable to locate element using chromedriver and Selenium in production environment

柔情痞子 提交于 2019-12-01 14:54:16
问题 I have a problem with selenium chromedriver which I cannot figure out what's causing it. Some weeks ago everything was working OK, and suddenly this error started to show up. The problem is coming from the following function. def login_(browser): try: browser.get("some_url") # user credentials user = browser.find_element_by_xpath('//*[@id="username"]') user.send_keys(config('user')) password = browser.find_element_by_xpath('//*[@id="password"]') password.send_keys(config('pass')) login =

Selenium can't locate iframe

馋奶兔 提交于 2019-12-01 14:03:13
Selenium fails to locate the iframe by ID and Name . This is for an automated checkout test on Shopify. The specific issue lies within the payment field. I found the ID and name of the iframe , which is card-fields-number-b1kh6njydiv00000 . iframe Image: Text Field Image: Code trials: driver.switchTo().frame("card-fields-number-b1kh6njydiv00000"); System.out.println("Found iframe"); The error is: org.openqa.selenium.NoSuchFrameException: No frame element found by name or id card-fields-number-b1kh6njydiv00000 It is possible to use XPath for this I believe. You will need to find the IFrame

How to wait for either of the two elements in the page using selenium xpath

假装没事ソ 提交于 2019-12-01 12:46:59
I have two elements I can wait for, I want to wait until either of them appears on the page. I am trying to use xpath locator. But it is not working. By.xpath("//*[(contains(@id,'idNumber1')) or (contains(@id,'idNumber2'))]")); Is this achievable? Please help me out. DebanjanB It is possible to wait for one of two elements in the page using ExpectedConditions.or() : WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.or( ExpectedConditions.elementToBeClickable(By.id("idNumber1")), ExpectedConditions.elementToBeClickable(By.id("idNumber2")) )); You can also do an

find and click element which has a changing CSS selector (python)

牧云@^-^@ 提交于 2019-12-01 11:17:53
I am writing a script which needs to click on an element of a page, however, the CSS selector changes everyday as the element changes it's location. Today it's called: PPTAmFCTable > tbody:nth-child(1) > tr:nth-child(11) > td:nth-child(3) > a:nth-child(1) Yesterday it was: PPTAmFCTable > tbody:nth-child(1) > tr:nth-child(10) > td:nth-child(3) > a:nth-child(1) And tomorrow it might be tr:nth-child(13) or so. I use the following code: def click_element_bycss(browser,css,timeout): element_present = EC.presence_of_element_located((By.CSS_SELECTOR,css)) WebDriverWait(browser, timeout).until(element

How to click on the first auto suggestion or first searched value on https://www.airdna.co/

大憨熊 提交于 2019-11-29 17:09:13
I'm trying to scrape the data from the website https://www.airdna.co i want to get the value of the first suggestion i managed the following code; The problem was i can't click on the first city to get the information can someone has a suggestion to solve this probleme #!/usr/bin/python # -*- coding: utf-8 -*- import re import time import csv import unittest import sys import datetime import os.path import pandas as pd from datetime import datetime from selenium import webdriver from bs4 import NavigableString from selenium.webdriver.common.by import By from selenium.webdriver.support.ui