webdriverwait

How to click an element which is loaded through Ajax through webdriver within Chrome

寵の児 提交于 2019-11-28 02:18:32
问题 Browser : Chrome V65 ChromeDriver: chromedriver.exe 2.37 Error occurs while webdriver trying to click an element. The below is my click(): def click(self): try: self.wait_for().visible() self._selenium_context().click() except Exception as e: raise NoSuchElementException def visible(self): ''' Check if the element is visible. :return: True or exception. ''' return Utils.wait_for(self.web_element.visible, self.interval, self.timeout) I had already waited for element visible and then clicked.

Selenium python Error: element could not be scrolled into view

给你一囗甜甜゛ 提交于 2019-11-28 01:16:33
I am working on automating the IdentiGO application for my company, and I'm getting the following error: Internal Server Error: /identigo Traceback (most recent call last): File "/Users/jane/Code/maynard_env/env/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/Users/jane/Code/maynard_env/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/jane/Code/maynard_env/env/lib/python3.7/site-packages/django/core/handlers

How to get rid of the hardcoded sleep()?

元气小坏坏 提交于 2019-11-27 09:51:14
def textfield(boxid,textadded): project = driver.find_element_by_id(boxid) project.send_keys(textadded) sleep(3) def dropdown(dropdownid, dropdownvalue): select = Select(driver.find_element_by_id(dropdownid)) select.select_by_visible_text(dropdownvalue) sleep(5) These 2 functions are functional however i'm using sleep() which is a bad practice since some my drop-downs and text fields will take longer than others to fill so i have to put the longest sleep value not to get errors, how can i fix these 2 functions using wait. As you are invoking send_keys() on the WebElement project , ideally you

How to add explicit wait in PageFactory in PageObjectModel?

被刻印的时光 ゝ 提交于 2019-11-27 09:50:44
I have added hardcode wait thread.sleep() in my below code. How to use explicit wait. I want to wait till "username" WebElement appear. My program is working perfectly. I have already written testcases. package com.pol.zoho.PageObjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.WebDriverWait; public class ZohoLoginPage { WebDriver driver; public ZohoLoginPage(WebDriver driver) { PageFactory.initElements(driver, this); } @FindBy

Unable to locate element of credit card number using selenium python

走远了吗. 提交于 2019-11-27 09:50:30
I am working to enter info in the input field with using selenium with python. The element I'm trying to access is <input type="tel" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" class="number" data-braintree-name="number" name="credit-card-number" id="credit-card-number" maxlength="22" placeholder="•••• •••• •••• ••••" aria-describedby="field-description-number" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAfBJREFUWAntVk1OwkAUZkoDKza4Utm61iP0AqyIDXahN2BjwiHYGU

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been “select” but was “span” while selecting a dropdown value

北慕城南 提交于 2019-11-27 08:41:39
问题 Here I am trying to select a value from dropdown using selenium script but I got this error in the console like "Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "span".. public class HomeUserManagement { public static void main(String args[]) { System.setProperty("webdriver.chrome.driver", "C:\\Users\\UMASHANKAR\\Documents\\selenuim\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.manage().window()

Message: stale element reference: element is not attached to the page document in Python

浪子不回头ぞ 提交于 2019-11-27 08:39:31
问题 I have been trying to run the following code in three different weblinks. Code works fine on one weblink. However, it throws an error message about "Message: stale element reference: element is not attached to the page document". I looked into forum's two previous threads (Python Selenium stale element fix and How to Navigate to a New Webpage In Selenium?) about the same error message but didn't get sort it out the issue. Here is my code: driver.get('https://github.com/avassalotti')

How to extract dynamic text from multiple child nodes within the html through getText()

非 Y 不嫁゛ 提交于 2019-11-27 08:23:57
问题 We have a Div containing some hard coded text and span containing some dynamic text values (refer below HTML code for more understanding). The resultant Text is: 1 Tasks to be updated from 'XYZ' to 'ABC' but when I am retrieving using Selenium locator i.e. final String actual = $("#bulk_update_confirmation").text(); Then the actual contains only "Tasks to be updated from to". All the dynamic text are missing. HTML code is as below (browser used is chrome) <div id="bulk_update_confirmation"

How to click on the reCaptcha using Selenium and Java

眉间皱痕 提交于 2019-11-27 08:22:02
问题 Why am I getting errors when trying to get the driver to click on the reCaptcha button? this is the site where i am trying to get it to work: https://rsps100.com/vote/760/ This is my current code so far: WebElement iframeSwitch = driver.findElement(By.xpath("/html/body/div[1]/div/div[1]/div/div/div[2]/div/form/div/div/div/div/iframe")); driver.switchTo().frame(iframeSwitch); driver.findElement(By.cssSelector("div[class=recaptcha-checkbox-checkmark]")).click(); 回答1: To invoke click() on the

Random Selenium E2e Tests Fail because of timeouts on Azure DevOps but work locally and with remote Selenium (BrowserStack Automate)

天涯浪子 提交于 2019-11-27 06:12:21
问题 I've got a suite of Selenium tests that work perfectly in my local environment and using Browserstack Automate, but fail on Azure DevOps. There are no configuration or setting changes when running on Azure Devops. We've followed all the documentation here: https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=vsts Random tests fail, never the same ones. The tests always fail because of timeouts. I wait for the pages to load for 5 minutes so it's not a case