Posts

Showing posts with the label selenium

How to SendKeys to input element that is created ad hoc when clicking in div element parent?

Image
Clash Royale CLAN TAG #URR8PPP How to SendKeys to input element that is created ad hoc when clicking in div element parent? I am stuck in this problem: our webpage has a dynamic table that will load values (students' marks) on a div element. If we click on said div , a new child element input will be appended to the div and we should be able to input a new mark using SendKeys method. However, when I try to SendKeys, a StaleElementReferenceException appears. div div input div SendKeys StaleElementReferenceException Here is the element when the input is added (had to use a breakpoint as the element disappears as soon as the div element loses focus): input div <tr> <td class="indice">1</td> <td id="accion-1-alumno-0" data-tooltip="" title="Bustos, Guido" class="has-tip titulo">Bustos, Guido</td> <td data-tooltip="" title="1º ESA" class="has-tip titulo"...

JAVA PDF Compare On PDF Documents From Different States

Image
Clash Royale CLAN TAG #URR8PPP JAVA PDF Compare On PDF Documents From Different States I am an automation engineer (working in a Java framework) and recently due to compliance issues I have a need to create a test that compares multiple pdf documents. The pdf documents are of a legal nature and contain different verbiage per state. I have never done this before. Just looking for implementation suggestions, was hoping to avoid something yucky. I would be accessing each document via a link, which would open in Docusign. The scenario would be open the document for New York and then compare it to a baseline document for New York, open a document for Maryland and then compare it to a baseline document for Maryland, open a document for Virginia and compare it to a baseline document for Virginia, etc. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and ...

Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click:

Image
Clash Royale CLAN TAG #URR8PPP Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click: I used Explicit Waits and i have warning: org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72). Other element would receive the click: ... Command duration or timeout: 393 milliseconds If I used Thread.sleep(2000) I don't receive any warnings. Thread.sleep(2000) @Test(dataProvider = "menuData") public void Main(String btnMenu, String TitleResultPage, String Text) throws InterruptedException { WebDriverWait wait = new WebDriverWait(driver, 10); driver.findElement(By.id("navigationPageButton")).click(); try { wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(btnMenu))); } catch (Exception e) { System.out.println("Oh"); } driver.findElement(By.cssSelector(btnMenu)).click(); Assert.assertEquals(driver.findElement(By.cs...

Read Description list in selenium python

Image
Clash Royale CLAN TAG #URR8PPP Read Description list in selenium python How can I read text of <dd> tag which has <dt> like Commodity code. <dd> <dt> `<dl class="dl"> <dt>Trading Screen Product Name</dt> <dd>Biodiesel Futures (balmo)</dd> <dt>Trading Screen Hub Name</dt> <dd>Soybean Oil Pen 1st Line</dd> <dt>Commodity Code</dt> <dd><div>S25-S2Z</div></dd> <dt>Contract Size</dt> <dd><div>100 metric tonnes (220,462 pounds)</div></dd> </dl>` from selenium import webdriver driver = webdriver.Chrome("C:\Python36-32\selenium\webdriver\chromedriver.exe") link_list = ["http://www.theice.com/products/31500922","http://www.theice.com/products/243"] driver.maximize_window() for link in link_list: driver.get(link) desc_list = driver...

Behaviour of dataprovider when one of the row is failed to process in @test method

Image
Clash Royale CLAN TAG #URR8PPP Behaviour of dataprovider when one of the row is failed to process in @test method I'm new to test ng framework. I'm planning to use data provider to pass the list of form values from the excel sheet. Let's say add product from the list in excel sheet. The @test method will run for each row from the excel sheet when I use data provider? What happens when one of the row failed to process? Does it run the rest of the rows after this failure? Do I have to re-initiate the selenium webdriver and login method again when it fails? I do not want to re initiate the webdriver for each failure.. My current application will retain the session even when the browser closes By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How to press Ctrl+V in Selenium WebDriver

Image
Clash Royale CLAN TAG #URR8PPP How to press Ctrl+V in Selenium WebDriver In one of my automated tests I need to press Ctrl + V in text box to paste text in it. But I can't do that. I'm using Selenium WebDriver for .net v. 2.35.0.0. Here is my code, it does not work. It presses Ctrl and then V , but text not gets pasted in the box: IWebDriver webDriver = new InternetExplorerDriver(); webDriver.Navigate().GoToUrl(@"C:UsersusDocumentsVisual Studio 2012ProjectsSeleniumTestsSeleniumTeststest.html"); var el = webDriver.FindElement(By.XPath(".//*[@id='fld']")); el.Click(); Actions builder = new Actions(webDriver); builder.KeyDown(el, Keys.LeftControl).Perform(); builder.SendKeys(el, "v").Perform(); builder.KeyUp(el, Keys.LeftControl).Perform(); webDriver.Quit(); Update: OS: Windows Server 2012, x64 Browser: IE10 Your code w...

Error while executing Selenium script - java.lang.NullPointerException - TestNG

Image
Clash Royale CLAN TAG #URR8PPP Error while executing Selenium script - java.lang.NullPointerException - TestNG I'm trying to run a script via testNG. But getting java.lang.NullPointerException. I have put in the driver initialisation code in BeforeMethod and rest of the code under Test. Please let me know what's wrong in my script due which Im getting the error.Thanks in Advance. My Script: public class NewTest { WebDriver driver = null; @BeforeMethod public void beforeMethod() { System.setProperty("webdriver.chrome.driver", Constants.Chrome_Driver); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.get("http://" + Constants.auth_Username + ":" + Constants.auth_Password + "@" + Constants.URL); } @Test public void f() throws InterruptedException { actions.Adm...

selenium firefox python won't locate upload button

Image
Clash Royale CLAN TAG #URR8PPP selenium firefox python won't locate upload button I'm using Selenium with Firefox (I've tried chrome but the success ratio on this one was significantly lower). I'm trying to locate an element (upload button) and the success ratio is nowhere near an acceptable percentage. Now I know that I could try to use just selenium to the input but it wont locate it as well no matter what I do. So I used AutoIt for the uploading part. frdriver.get('') time.sleep(11) try: # el = WebDriverWait(frdriver, 15).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[1]/header/div[2]/div[2]/div/div/form/i[2]'))) el = frdriver.find_element_by_xpath('/html/body/div[1]/header/div[2]/div[2]/div/div/form/i[2]') try: el.click() print(el) #ActionChains(frdriver).move_to_element(el).click().perform() try: #element = WebDriverWait(frdriver, 15).until(EC.presence_of_element_locat...

Selenium Python get_element by ID failing

Image
Clash Royale CLAN TAG #URR8PPP Selenium Python get_element by ID failing Can someone help me understand why my code fails to find the element by ID. Code below: from selenium import webdriver driver=webdriver.Firefox() driver.get('https://app.waitwhile.com/checkin/lltest3/user') element = driver.find_element_by_id("guestPhone") Inspecting element shows the ID clearly. <input type="tel" name="guestPhone" id="guestPhone" class="form-control ng-pristine ng-empty ng-invalid ng-invalid-phone-validator ng-invalid-required ng-touched" ng-model="form.model" ng-model-options="{ 'updateOn': 'default blur', 'debounce': { 'default': 350, 'blur': 0 } }" uib-typeahead="guest.phone for guest in form.onChange({value:$viewValue})" typeahead-min-length="6" typeahead-on-select="form.onSelect({guest:$item})" typeahead-select-on-exact="true" uib-to...

looking to get dynamic website value using selenium and phantomJS

Image
Clash Royale CLAN TAG #URR8PPP looking to get dynamic website value using selenium and phantomJS i am trying to get the value for a timer >http://prntscr.com/kcbwd8 on this website > https://www.whenisthenextsteamsale.com/ and hopefully store it in a variable. import urllib from bs4 import BeautifulSoup as bs import time import requests from selenium import webdriver from urllib.request import urlopen, Request headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3"} browser = webdriver.PhantomJS() browser.get('https://www.whenisthenextsteamsale.com/') soup = bs(browser.page_source, "html.parser") result = soup.find_all("p",{"id":"subTimer"}) for item in result: print(item.text) browser.quit() i have tried using the code above but it returns this error > C:UsersroberAnaconda3libsite-packagesseleniumwebdriverphantomjswebdriver.py:49: User...

log into twitter using selenium python

Image
Clash Royale CLAN TAG #URR8PPP log into twitter using selenium python I am trying to log into twitter by using selenium. I am using a Python program. browser = webdriver.Chrome(chromedriver) browser.get('https://twitter.com/login') username = browser.find_element_by_class_name("js-username-field") username.send_keys("admin") password = browser.find_element_by_class_name("js-password-field") password.send_keys("admin") signin_click = WebDriverWait(self.driver, 500000).until( EC.element_to_be_clickable((By.XPATH, '//*[@id="page-container"]/div/div[1]/form/div[2]/button')) ) signin_click.click() I am using correct class name for username and password. But, it is showing, selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value' I also tried to do it with name attribute , name username = browser.find_element_by_name("session[username_or_email]")...

Error CS0246: The type or namespace name 'WebDriverWait' could not be found?

Image
Clash Royale CLAN TAG #URR8PPP Error CS0246: The type or namespace name 'WebDriverWait' could not be found? I am new to creating tests in visual studio using selenium and C#. I have two files, one is search engine maing page and the other is a testing file. The files can be found here---https://www.automatetheplanet.com/page-object-pattern/ I always get this error; Below are screenshots of the problem. Error CS0246: The type or namespace name 'WebDriverWait' could not be found? What am I doing wrong?? below is the following code- using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; [TestClass] public class SearchEngineTests { public IWebDriver Driver { get; set; } public WebDriverWait Wait { get; set; } [TestInitialize] public void SetupTest() { this.Driver = new FirefoxDriver(); this.Wait = new WebDriverWait(this.Driver, TimeSpan.FromSeconds(30)); } [TestCleanup] public...

Clicking The “Unclickable” Button with Python, selenium, chromedriver

Image
Clash Royale CLAN TAG #URR8PPP Clicking The “Unclickable” Button with Python, selenium, chromedriver I am running into trouble with a script trying to click a button with the following code in Python 3.7 using Selenium and Chromedriver: driver.find_element_by_xpath("/html/body/section/main/section[1]/section[1]/div/div/div/form/div/div/div[1]/ul/li[2]/h2/button").submit() search_cit = driver.find_element_by_xpath("/html/body/section/main/section[1]/section[1]/div/div/div/form/div/div/div[2]/div[3]/div/input") search_cit.clear() search_cit.send_keys(search_city) driver.find_element_by_xpath("/html/body/section/main/section[1]/section[1]/div/div/div/form/div/div/div[2]/div[4]/button[1]").click() and am met with the following error:enter image description here By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie p...

How to handle browser notification popup which is without any elements?

Image
Clash Royale CLAN TAG #URR8PPP How to handle browser notification popup which is without any elements? How to press the OK button as per the image. I can switch to this window. but it is not loaded till i click ok, so there is no any elements. Alert handle does't helped too. Autoit cannot detect this pop up message too. disable-notifications cant help too. Any ideas? Two screeshots is added. OK Firefox snapshot: Chrome Snapshot: p.companieGenreal.sActivities().click(); driver.switchTo().defaultContent(); String parent = driver.getWindowHandle(); p.companieGenreal.sAddNew().click(); p.companieGenreal.sAddJobOrder().click(); p.companieGenreal.sContract().click(); swithToChildWindow(parent); driver.switchTo().alert().accept(); Your code trials? – DebanjanB 1 hour ago I can switch to this window. How did yo...

how to upload file in appium for mobile app automation?

Image
Clash Royale CLAN TAG #URR8PPP how to upload file in appium for mobile app automation? I am trying to automate the file upload functionality for mobile application automation. I have some pdf/image file stored in my mobile device which is need to be uploaded. What will be the possible way to automate this scenario? What have you tried so far? – Andrei Suvorkov 5 mins ago By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.