FAQ Database Discussion Community


Return html code of dynamic page using selenium

python,python-2.7,selenium,selenium-webdriver,web-scraping
I'm trying to crawl this website, problem is it's dynamically loaded. Basically I want what I can see from the browser console, not what I see when I right click > show sources. I've tried some selenium examples but I can't get what I need. The code below uses selenium...

Using Selenium in C# without opening a browser in Visual Studio 2013

c#,selenium,visual-studio-2013
I have been using Selenium along side C# in Visual Studio 2013. I will make a call to: driver.Navigate().GoToUrl("http://<insert webpage>"); ...Which will open whichever WebDriver I choose to use. From here, I will make calls to links/text boxes/menus as I need to. However, I was wondering if there is a...

How can i increase session timeout (which is 30 minutes by default)

selenium,android-testing,selendroid
I want to handle server timeout in programmatically. My codes goes like this. SelendroidConfiguration config = new SelendroidConfiguration(); config.addSupportedApp("apk/test.apk"); selendroidServer = new SelendroidLauncher(config); URL url = new URL("http://localhost:4444/wd/hub"); // ------------------------------------------------------- SelendroidCapabilities test= SelendroidCapabilities .device("com.test.android:1.0"); driver = new SelendroidDriver(url, test); ...

Getting value from div which contains exact string using Selenium IDE

selenium,selenium-ide
I am trying to get a value from a nested div in a web page using Selenium IDE where class names are repeated but contain unique strings, such as the structure below, but am having no luck. <div class='ClassName'> <div class="col_Num">1 </div> <div class="col_Val">5.00 </div> </div> <div class='ClassName'> <div class="col_Num">2...

Unable to click on list button option in selenium : Exception Element not visible

selenium
Hi I am trying to select on the list option cold and Flu but I am getting Element not visible exception, Can someone please help me how to select it in selenium script. Site URL : http://www.healthdirect.gov.au/symptom-checker/tool?symptom=COLD Colds and flu Here is my selenium code public void selectspecificSymptom(String arg) throws...

Parsing html using Selenium - class name contains spaces

python,html,parsing,selenium,text
I'm trying to parse some html using Selenium. The problem is that it raises error in case the class name contains spaces. Here is the tag I'm searching for: <p class="p0 ng-binding">text</p> I've tried these two options: result.find_element_by_class_name('departure').find_element_by_css_selector('p.p0 ng-binding').text result.find_element_by_class_name('departure').find_element_by_class_name('p0 ng-binding').text >>> selenium.common.exceptions.InvalidSelectorException: Message: The given selector p0 ng-binding is...

Selenium can't seem to find and click a button on website? - Python

python,selenium,selenium-webdriver,find,element
I am trying to make software that automaticly collects data for me from fiverr.com website. It searches for specific term, and then it should press LOAD MORE button at the end of page, and keep clicking it until it loads all the 'gigs'. Anyway, I have good idea of how...

Selenium: Wait until text in WebElement changes

python,selenium,selenium-webdriver
I'm using selenium with regex for Python 2.7.3. to retrieve the content from an active search box in a webpage. from selenium import webdriver from selenium.webdriver.common.keys import Keys import pandas as pd import re from time import sleep driver = webdriver.Firefox() driver.get(url) df = pd.read_csv("read.csv") def crawl(isin): searchkey = driver.find_element_by_name("searchkey")...

Can't get the value in an input with protractor

javascript,angularjs,selenium,testing,protractor
I'm using angularJS to develop an application. To test it I use protractor. I want to check the value in an input area. This is my input: <input id="rank-max-range" class="form-control has-feedback" name="inputMax" type="number" placeholder="Maximum" ng-model="selectedItem.range.max" min="{{selectedItem.range.min}}" max="{{selectedItem.answers.length}}"> And this is the test: it('should be fill the max range with the...

Not able to locate the dropdown value using selenium webdriver

java,selenium,selenium-webdriver
I want to select the value from dropdown. Currently I am able to click on dropdown but not able to select the value from the dropdown. Below are the code which I am using for selecting the value from the dropdown. temp.click(); driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); Select clickThis = new Select(temp); try{...

Python Selenium selecting div class

python,selenium
So I'm writing a script using Selenium but I got stuck at finding a div class. The structure on the website is like this: <div class="field first_name"> <input type="text" placeholder="First Name"></input> </div>` Already tried something like driver.find_element_by_xpath("//field[@first_name]") But it didn't work for some reason, maybe I did it wrong or...

Webdriver C# -Click second linktext not first

c#,selenium,webdriver
By this line I click on the first text, but how can I click the second exact text? driver.FindElement(By.PartialLinkText("Play")).Click(); ...

Python Selenium: 2 buttons with same class?

python,selenium,selenium-webdriver
I am trying to click on button with class btn3, but there is another button on same page with same class. Button I want to click: <div class="btn3">Follow</div> Button I DON'T want to click: <div class="btn3">Add Site/Page</div> My code: driver.find_element_by_class_name('btn3').click() ...

How to Pass Dynamic Values in Xpath

c#,selenium,xpath,selenium-webdriver
This is my First Question in this blog. Am working on Selenium with C# Automation and have hit a road block. I need to click on a Checkbox which is not static and the ID is also not static so i have decided to use XPATH. XML Code: <div id="divJqTreeAPOS"...

XPath for child element

selenium,xpath
What is the Xpath to select the first element of this jquery selector: $('.A .B:eq(1)') ? HTML Sample <div class="x A z"> <div class="y"> <div class="r B z"></div> <---- that is that I need to select <div class="r B z"></div > ... So far I've tried this: (//div[(@class='A') and div[contains(concat('...

Cannot assign an inst variable in Switch “--user-data-dir” in Selenium Wedriver Chrome

ruby,google-chrome,selenium,selenium-webdriver,selenium-chromedriver
I have the following code and i want to create a user Directory with the name 'mydir' where chrome should output console logs, but wat happens is it creates a directory #{dir} instead. I also tried using CONST Variables still the same result. Can some help me out? require "selenium-webdriver"...

Java Selenium WebDriver with Yandex

java,selenium,browser,selenium-webdriver,yandex
At the moment, I use Firefox as browser for my Java Application with Selenium. But Firefox is slow. Is it possible to use Yandex as browser? Didn't find anything in Google. Does Selenium supports Yandex? For Chrome I need the .exe for using Chrome as browser. Is this possible with...

Selenium Web Driver : How to map html elements to Java Object.

selenium,webdriver,mapping
As part of Selenium Web-driver learning I came across a scenario. Please let me know the professional approach to proceed. I am testing a eCommerce application where while I click on Mobile link all mobile phones are getting displayed.I want to check whether they are sorted based on name and...

selenium webdriver - xpath locator not working if element's text contains Unicode Characters

selenium,xpath,unicode,selenium-webdriver,webdriver
I'm trying to select an option contained inside a menu. It's not a select menu, but it's styled to appear as such. Anyway, if the text contained inside the menu is in English, I can select it ok. Trouble is, the text I need to select is french so it...

How to map browser dialog using capybara/selenium

ruby,selenium,capybara
What is the best way to handle browser dialogs (with ok/cancel buttons) using capybara/selenium? The way I found easiest is by running the following: dialog = page.driver.browser.switch_to.alert dialog.accept Any thoughts for a better approach? Whoever downed this post please give a valid reason... it's not helpful to down vote with...

Execute javascript within webpage with selenium WebDriver

java,javascript,html,selenium,webdriver
I am trying to execute a javascript method on a webpage with the selenium WebDriver. I am able to execute my own script on the page, but not call the method from the page's HTML. Here is the HTML function Search(){ if(check(document.forms[0],"searchResults")){ var fieldCode = ""; var fieldText = "";...

Selenium wait until email is sent

java,selenium,selenium-webdriver,automation,webdriver
I am writing a simple program that tests the functionality of gmail and this include sending an email. I have the program send an email, and once it is acknowledged that it has been sent, it logs out. I do not want to logout while the message is being sent,...

Python: Terminate an imported script without killing the script that is doing the import

python,selenium
Sorry whoever reads this before I finish; it posted before I wanted to... I have a ton of Selenium tests that I'd like to run overnight. However, each test, as of now, requires me to login to the server (which is slow - takes about half the duration of the...

Eclipse Selenium Facebook login issue (new page email) driver.findElement(By.id(“email”)).sendKeys(“”); Java

java,eclipse,email,selenium,facebook-login
I am trying to login facebook but there is a problem. I want to write "email" to facebook login page, but it's writing to my website's login page. i don't want to write email to email input of site.com, i want to write email to facebook login input which is...

Selecting driver dynamically from config file in selenium

c#,selenium,selenium-webdriver
I have written some ATPs using Selenium Web Driver in C#. Currently I am using ChromeDriver to execute my scripts. But I want to take the driver information(like chrome, firefox...) dynamically from some source(like config file) and create driver object accordingly. One way to do that is getting the driver...

selenium xpath unable svg element

html,selenium,xpath
I am working on a web page which consists of 6 svg tags i have to verify each svg in that one is like the following one there are totally 26 paths in this i have to locate the 18th one html is like this <div> <svg> <circle r="80" cy="80"...

For Selenium, how to migrate to using WebDriver for HttpCommandProcessor?

java,selenium,selenium-webdriver,selenium-rc,deprecated
I recently noticed that the HttpCommandProcessor has been marked as deprecated, but there doesn't seem to be anything that replicates its functionality that isn't deprecated. In particular the WebDriverCommandProcessor does not have a browser start command, and the start(String s) method just throws an UnsupportedOperationException. I am not sure about...

Is it possible to get code coverage data for integration tests using Visual Studio?

c#,visual-studio,selenium
I am testing a ASP.NET application and would like to get code coverage information about how much of the product code my integration tests exercise. Our libraries are already instrumented and the symbols (pdb) files are available, but I need to know exactly how to enable Visual Studio to capture...

How to get the value from selectbox?

javascript,selenium,testing,protractor,end-to-end
I am trying to verify that correct option is selected from selectbox using protractor. This is how I pick value from selectbox: element(by.id('form-mileage-unit')).click().then(function() { element(by.cssContainingText('option', browser.params.lengthUnit)).click(); });; So base on this I write code below: it('Verify paint color', function() { element(by.id('form-mileage-unit')).click().then(function() { element(by.cssContainingText('option', browser.params.lengthUnit).getAttribute("value")).toEqual(browser.params.lengthUnit); });; });...

How to click on a text in a Container Column Container Using Selenium C#?

c#,selenium
HTML looks like below <div id="ctl00_ContentColumnContent_PatientPanel" > <span id="ctl00_ContentColumnContent_lblPatient" class="label required"> Select a Patient: </span> <select name="ctl00$ContentColumnContent$ddlPatient" id="ctl00_ContentColumnContent_ddlPatient" class="select wide" size="10"> <option value="0">**Delhi**</option> <option value="5422">Mumbai</option> <option value="326">Chennai</option> </select> <span...

Selenium C#: Store element's position on graph as a variable

c#,selenium,selenium-webdriver
I want to store the position of a circle from this graph as a variable, so I can compare it to the position saved in the database. <circle class="" ng-touch="manualGraph($event, c, 'left')" ng-mousedown="manualGraph($event , c,'left')" ng-show="audiogram.leftEnabled && manual" ng-repeat="c in audiogram.tonePoints | filter: {'resultSet': 'left'} | orderBy : 'stimulusFrequency'"...

Selenium catch popup on close browser

java,selenium,browser
I'm trying to test that when I close my window a popup shows with a warning message. I've tried both driver.close() and driver.quit() after making sure I'm on the proper window but this just terminates the process since my popup doesn't show. I could test it by using the awt...

Is it possible to save an adobe pdf file using selenium web driver and one click build Jenkins

java,pdf,selenium,jenkins
Here's my dilemma. I'm creating some automation tests using selenium web driver coding in Java. The main output of the software is to load a PDF in adobe acrobat. I'm also using Jenkins which is why my problem has come about as I wont be able to physically see the...

How to get all direct(immediate) rows from WebElement Table

selenium,xpath,css-selectors
From the below table I need immediate row elements using Xpath or "css-selector" or Selenium API :- element.findelements. Please help. <table id ="Main"> <tbody> <tr id="row_1"> <tr id="row_1_1"> <tr id="row_1_1_1"> </tr> </tr> </tr> <tr id="row_2"> </tr> <tr id="row_3"> <tr id="row_3_1"> </tr> </tr> </tbody> </table> Expected Output:- [<tr id="row_1">,<tr id="row_2">,<tr id="row_3">]...

webdriver C# - click this element with XPath position?

c#,selenium,xpath,webdriver
I have an element whit this XPath Position: //td[4]/a I try this but does not work: driver.FindElement(By.XPath(".//*[@position='//td[4]/a']")).Click(); Using C# Webdriver and not java, please....

Loop through downloading files using selenium in Python

python,selenium,selenium-webdriver,web-scraping,python-3.4
This is a follow-up question to this previous question on how to download ~1000 files from Google Patents. I would like to iterate through a list of filenames fname = ["ipg150106.zip", "ipg150113.zip"] and simulate clicking and saving these files to my computer. The following example works for me and downloads...

When starting Nightwatch with Grunt, the website server is not started

javascript,node.js,selenium,gruntjs,nightwatch.js
I am using Nightwatch.js to run system tests for a website. I want to automate the tests by running them via grunt. My Gruntfile contains these lines: ... var nightwatch = require('nightwatch'); nightwatch.initGrunt(grunt); ... nightwatch: { options: { standalone: true, test_settings: { "default": { "launch_url": "http://localhost", "selenium_port": 4444, "selenium_host": "localhost",...

Unable to select text boxes in selenium webdriver through XPath?

selenium,xpath
My HTML <table border="2" style="background:gray"> <tbody> <td class="std"> <input id="ActQ1Revenue" type="text" name="amount" disabled="disabled" maxlength="20" style="background:wheat"> </td> </tr> <tr> <td class="atd"> <input id="ActAprRevenue" type="text" name="amount" maxlength="20"> </td> </tr> <tr> <td class="atd"> <input id="ActMayRevenue" type="text" name="amount" maxlength="20"> </td> </tbody> </table> My XPath...

Difference between ancestor and ancestor-or-self

xslt,selenium,xpath,selenium-webdriver
I know about ancestor in xpath but what is this ancestor-or-self. when we have to use ancestor-or-self.Please give me any examples.

Appium xpath escaping apostrophes

java,selenium,xpath,appium,apostrophe
I have the code below in my appium script: public boolean isErrorDisplayedUnrecognisedLoginCredentials() { return appDriver.isElementExist(By.xpath("//UIAStaticText[@name='We don't recognize this user ID or password']")); } The test is hanging since it treats the apostrophe in "don't" as a final apostrophe to close off the @name value. I have tried escaping the apostrophe...

WaitForElement in Selenium WebDriver?

java,selenium,webdriver
Currently, I am using Thread.sleep to make the scripts to wait for certain element to be loaded. Execution takes long time.. Instead this, i need something waitforElement once it is displayed i need to continue my execution rather this Thread.sleep.. Can someone tell me that the below logic looks ok??...

Protractor, login to asp,net MVC login page, wait for default page then , redirect to angular page and do tests…how?

c#,angularjs,asp.net-mvc-4,selenium,protractor
I'm trying to implement Protractor test on my MVC Project that we are slowly converting to Angular I login on a MVC login page, enter the login and password, Click login, then I need to wait for the login to go through several pages, and get to the default screen....

Launch Watir/Selenium Chrome driver binary from an arbitrary location

selenium,watir,selenium-chromedriver
I want to use Watir to start a chrome for an older version of chrome, say /Application/Google Chrome 30.app Here's a ref link saying chromedriver expects Chrome install at specific location: Mac /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome Here's a ref link for setting up Chrome executable in a non-standard location ChromeOptions options...

Adding a public class to click using xpath with Java Selenium

java,selenium,xpath
I am trying to create a public class to click an item on a webpage with selenium by just passing it the xpath and driver I'm using. I want to be able to just do: ClickByXpath(driver, "/html/body/div/div[3]/form/div[2]/div[2]/div[1]/div[1]/div[3]/div/div[3]/div/input[1]"); Here's the code I'm using, but it's complaining that the method xpath string...

Find element by class name

python,parsing,selenium,selenium-webdriver,css-selectors
I'm trying to find one tag using we.find_element_by_css_selector('p.p1.transfer strong.ng-binding').text The problem is that there is sometimes a 'strong' tag before the tag I'm searching for which is very similar but it's class is: class="ng-binding ng-hide" instead of class="ng-binding". But when I try to find it it finds the first tag....

Protractor in Node: How do I order my tests to run synchronously?

node.js,selenium,jasmine,protractor
I'm wondering how to execute multiple "describe" blocks in synchronous order? describe('Go To Home Page', function () { browser.ignoreSynchronization = true; it("Url should be on Login Page", function () { browser.get(HomePageUrl).then(function () { browser.wait(urlChanged(loginPageUrl), 2000).then( function (newurl){ var url = browser.getCurrentUrl().then(function (url) { expect(url).tobe(loginPageUrl); //I know I'm at Login page...

Protractor image upload doesn't work on IE and firefox

javascript,selenium,file-upload,selenium-webdriver,protractor
I am trying to upload image on the input type:file control using protractor. I am using the below code: var basePath='../testdata/testappicons/accepted'; var randomIcon=randomIntFromInterval(1,6); var overallPathToIcon=basePath+randomIcon+'.png'; var fileToUpload = overallPathToIcon; console.log(fileToUpload); var absolutePath = path.resolve(__dirname, fileToUpload) browser.executeScript('$(\'input[type="file"]\').attr("style", "");'); $('input[type="file"]').sendKeys(absolutePath); The above code works well on the chrome and I am able...

Difficulty clicking an anchor tag using href as locator

java,selenium,css-selectors,type-mismatch
How to locate identifiers in Selenium for the following line of code? <a href="loginPage" class="loginBtn" data-toggle="modal" data-target="rnr-loginPanel">Login</a> I have tried: driver.findElement(By.xpath("//a [contains ( @href = 'loginPage' )]")).click(); but it is not working for me....

Selenium WebDriver: unable to locate element inside iframe using TinyMCE editor

java,selenium,iframe,selenium-webdriver
Maybe my question is similar to this Selenium WebDriver NoSuchElementException: Unable to locate element however I still can't find required element. The element itself looks: body id="tinymce" class="mceContentBody" contenteditable="true" onload="window.parent.tinyMCE.get('compose_295_composeEditor').onLoad.dispatch();" dir="ltr" style="overflow: auto;"> the iframe containing this element is: body id="tinymce" class="mceContentBody" contenteditable="true"...

Junit parameterized testing ,a different thought

java,selenium,junit
Here, I have a custom independent component which accept input as a jar file and identify the junit test classes from it and execute them using the code given below. Result result = JUnitCore.runClasses(cls);//cls is Class<?>instance. Next thing I required is a provision to inject parameters (Assuming that input jar...

Selenium Simple Chrome WebDriver: java compilation and execution problems

java,maven,selenium,junit
I'm new to Selenium and I have little knowledge of the java compilation and run process, because I always compiled and executed with the help of the IDE. My problem I'm trying to run a simple test with selenium (for learning purposes) to request "www.google.com" and assert that the title...

Selenium Webdriver: how to use xpath filter?

java,selenium,xpath,webdriver
I'm trying to follow the Selenium Webdrive Basic Tutorial in the case of using HTML tables here http://www.toolsqa.com/selenium-webdriver/handling-tables-selenium-webdriver/ The code of "Practice Exercise 1" in that page doesn't work: the problem seems to be about the xpath filter here String sCellValue = driver.findElement(By.xpath(".//*[@id='post-1715']/div/div/div/table/tbody/tr[1]/td[2]")).getText(); and here driver.findElement(By.xpath(".//*[@id='post-1715']/div/div/div/table/tbody/tr[1]/td[6]/a")).click(); The page used in...

Quickly get class attribute of every WebElement with Selenium in Java

java,selenium,selenium-webdriver
I'm looking to get the class attribute of every WebElement on the page quickly with selenium. Currently, I'm doing the following: allElements = new ArrayList<WebElement>(m_webDriver.findElements(By.cssSelector("*"))); for (WebElement element : allElements) { String className = element.getAttribute("class"); } This process is incredibly slow, taking upwards of thirty seconds on a page with...

Chrome driver information in console

java,google-chrome,selenium,webdriver,selenium-chromedriver
Im using ChromeDriver in my selenium tests, in console Im getting: Starting ChromeDriver 2.15.322448 (521791b310fec1797c81ea9a20326839860b7d3) on port 15823 is there any way to skip or not show this at all in console output?...

Using selenium at hosted app?

python,django,selenium,selenium-webdriver
I want to click one button with my Django app that I have hosted at DigitalOcean. Here it is how I do it offline: import selenium.webdriver as webdriver firefox = webdriver.Firefox() firefox.get("http://www.hltv.org/match/2296366-gplay-gamers2-acer-predator-masters-powered-by-intel") element = firefox.find_element_by_id("voteteam1") element.click() But can I use it online? Maybe there is other solution?...

http.request in intern functional test

node.js,selenium,selenium-webdriver,intern
I am trying to post to a url to get a username and password so I can log into my website to do functional testing. I start up selenium server and run this basic test with a request to a posting service. define([ 'intern!object', 'runtime/testConfig', 'intern/dojo/node!nconf', 'intern/dojo/node!http' ], function(registerSuite, conf,...

Selenium select with class

python,class,selenium
I have been learning python now for a while, and just got into selenium lately. Anyhow.. I want to find text with class 'fs18' on website, and save it into points_no --> http://i.imgur.com/myt2laM.png Here is my code: points_no = driver.find_element_by_class_name("fs18") But that doesnt work at all.. It just gives me...

WebElement to do a google search

java,selenium,selenium-webdriver,selenium-chromedriver
I am using selenium and its WebDriver API to do a quick google search for something. The examples that are usually given include this: driver.get("https://www.google.com"); WebElement element = driver.findElement(By.name("q")); element.sendKeys("Cheese"); element.submit(); Apparently this will search for 'Cheese' in google. But I'm not sure where they got 'q' from or how...

Selenium - get all children divs but not grandchildren

python,html,parsing,selenium,selenium-webdriver
I'm trying to parse a html file. There are many nested divs in this html. I want to get all child divs, but not grandchildren etc. Here is a pattern: <div class='main_div'> <div class='child_1'> <div class='grandchild_1'></div> </div> <div class='child_2'> ... ... </div> So the command I'm looking for would return...

Not able to click ExtJS Dropdown button and select list elements - Selenium Webdriver Java

java,selenium,testing,extjs,selenium-webdriver
I am having difficulty in clicking a drop down and selecting option from the list. Below screenshot of the application. Our application uses heavy ExtJS and below is the HTML code for dropdown button and textbox. <div id="combobox-1115-bodyEl" class="x-form-item-body x-form-trigger-wrap-focus" role="presentation" style="width: 325px;"> <div id="ext-gen1273" class="x-hide-display x-form-data-hidden" role="presentation"></div> <input id="ext-gen1272"...

Multi user file property Selenium

java,selenium,junit,webdriver,automated-tests
I made autotest on Selenium. This test I will start on JMeter for load testing for 10, 20, 50+ users. What I should do. I create a property file (configuration file) and put there URL, Login, Password. So I made a cycle and put there this code where I'll start...

Selenium Web Driver: findElement(By.name … and headless browser

java,selenium,selenium-webdriver,webdriver,headless-browser
I'm trying to follow the Selenium Webdrive Tutorial http://www.toolsqa.com/selenium-webdriver/headless-browser-testing-selenium-webdriver/ There is a simple test, here you are the steps: Open webpage http://google.com Get the title of the page. Search for ‘Selenium’ Check the title of the page again. Starting from the class code sample, here you are my code package...

Python Selenium - Login error

python,selenium
I'm trying to input login details into GMAIL with the below coode from selenium import webdriver import getpass chromedriver = 'C:\Python34\Scripts\chromedriver' driver = webdriver.Chrome(chromedriver) driver.get('http://www.google.com/adwords/') signin = driver.find_element_by_class_name('ignore-channel') signin.click() email = input('Enter your Email ID : ') password = getpass.getpass('Password :') email = driver.find_element_by_id('Email') email.send_keys(email) passwd = driver.find_element_by_id('Passwd') passwd.send_keys(password) submit...

Python AttributeError in Testing Goat

python,unit-testing,selenium
I've just started working through Test-Driven Development with Python and don't understand the AttributeError I'm getting as it's different from the one in the book. The code to run a selenium test is: from selenium import webdriver import unittest class new_visitor_test(unittest.TestCase): def set_up(self): self.browser = webdriver.Firefox() def tear_down(self): self.browser.quit() def...

Protractor not able to count links in a list (li)

javascript,angularjs,selenium,protractor,element
This is my first message, basically because is the first time that I have not been able to find the answer to my question. I am trying to count the number of li elements in a dropdown. Each <li> has a` link. Here is the HTML code: <div ko-dropdown="ko-dropdown" ng-keyup="onKeyup($event)"...

Webpage >> Frame >> popup window handling

java,selenium,selenium-webdriver
I have this webpage which I am trying to automate. here are the steps and functioning of application. Launch Application using Selenium On clicking certain button a frame would pop up over the main web page I able to perform operations on frame thru selenium web driver but there is...

How do I tell Selenium that an Angular controller has “loaded”

javascript,angularjs,selenium
I've got some UI tests that are attempting to test that a click on an element makes something else appear. There's an existing check for all tests that looks to see if the DOM is Ready, however there's a small amount of time between that even firing and the app.controller()...

Browser.wait() until .getAttribute() returns true

javascript,angularjs,selenium,testing,protractor
I'm still learning Protractor so I'm not sure if this is a simple answer that I'm not getting but I'm just trying to have the browser wait until the attribute I'm retrieving is true. I'm testing the pizza option for this site. Complete code: browser.get('https://material.angularjs.org/latest/#/demo/material.components.select'); var topping = element(by.model('topping')); topping.click();...

TestNG with IE webdriver

java,selenium,testng
Hi Im a newbie to selenium, i was trying to use TestNG with IE webdriver, Now i cant instantiate the IE driver directly under the class (Not the main method). When i do that i get the below error: Multiple markers at this line - Syntax error on tokens, FormalParameter...

How to Find class inside in
, using Selenium WebDriver

selenium,webdriver
here is the code: <div class="padding-tlb"> ....Some code.... </div> <article class="non-article-login"> <div class="one-fourth-percent columns-percent">&nbsp;</div> <div class="one-half-percent columns-percent"> <div class="one-fourth-percent columns-percent"> User ID </div> </div> </div> </article> I want to check if exist the class "one-fourth-percent columns-percent". WebElement test = driver.findElement(By.className("one-fourth-percent columns-percent")); But...

Upload file - Protractor

javascript,selenium,testing,protractor,end-to-end
I fight with protractor because for some tests I need to UPLOAD file. My HTML looks like: <div class="panel-footer"> <ul class="list-unstyled"> <!-- ngRepeat: file in imagesToUpload --> </ul> <button class="btn btn-sm btn-success pull-right ng-binding ng-hide" ng-show="imagesToUpload.length" ng-click="uploadImages()">Nahrát na server</button> <button class="btn btn-sm btn-primary ng-binding" ng-file-select="onImageSelect($files)" data-multiple="true" style="overflow: hidden;">Vybrat soubory<input...

Scrapy not entering parse method

python,selenium,web-scraping,web-crawler,scrapy
I don't understand why this code is not entering the parse method. It is pretty similar to the basic spider examples from the doc: http://doc.scrapy.org/en/latest/topics/spiders.html And I'm pretty sure this worked earlier in the day... Not sure if I modified something or not.. from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.by import...

What can cause `UnreachableBrowserException: Could not start a new session`?

selenium,selenium-webdriver,webdriver
I try to run a selenium client that interacts with remote selenium web driver server. Some (only some) of my tests are failing because of connection refused. What should I check on the machine that hosts the server? com.x.inject.ProvisionException: Guice provision errors: 1) Error in custom provider, org.openqa.selenium.remote.UnreachableBrowserException: Could not...

How to open url on another tab at same browser using selenium webdriver?

java,selenium,selenium-webdriver
I want to open a URL on new tab by clicking on button for add account. I am working with framework, also I've found some solution but don't understand how to apply it. Below are the code where I've find the element and return it for performing the operations. Can...

Insert different variable (pulled from dictionary) into URL within a loop

python,loops,selenium
I would like to create a loop that visits a different URL based on a variable that is inserted into the URL. There are dozens of variables to be inserted, and I'm thinking there's an alternative approach to what I have below: url1 = "cat" url2 = "dog" url3 =...

Not able to verify text after login with selenium Webdriver script

selenium,selenium-webdriver
I am trying to automate login functionality with selenium webdriver using TestNG framework. I want to verify the text after login like Hi [[email protected]]. This is the order in which links are present on page : TrackOrder | Notification | Singnup | Login My method of doing: I clicked on...

selenium exceptions.NoSuchElementException:

python,selenium,webdriver
The html code snippet as: <thead id="addDet:cust:th" class="emp"> <tr id="addDet:cust:ch" class="emp"> <th class="emp" scope="col" id="addDet:cust:ch:j_idt484">S. No.</th> <th class="emp" scope="col" id="addDet:cust:ch:j_idt487">Name <font color="#FA5882">*</font></th> I tried to fill the field as: driver.find_element_by_id("addDet:cust:j_idt487").send_keys("XX") But I am getting the error as: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:...

Protractor, Done and Expect, why do we need wait?

selenium,selenium-webdriver,jasmine,protractor
I thought Done would make things run synchronously, meaning after I click a link, the click call back would happen after the click, apparently not as this doesn't work. browser.ignoreSynchronization = true; var firstURL = "https://www.google.com/?gws_rd=ssl"; describe("test", function () { browser.get("http://www.google.com"); it("Should be on google url", function () { expect(browser.getCurrentUrl()).toBe(firstURL);...

Value attribute of a text box retains old value even after new value has been keyed in

java,selenium,selenium-webdriver,webdriver
This is the HTML I have for a text box on a form: <input type="text" onblur="javascript:itemLostFocus('18A3461989AC0244E050A20AB17C4671');" onkeydown="javascript:itemChanging('18A3461989AC0244E050A20AB17C4671');" value="972" name="18A3461989AC0244E050A20AB17C4671" maxlength="3" size="3"/> What I do next is update the text box input to 123 from 972. Now if I check the value attribute of the same text box using the getAttribute("value")...

Selecting elements by ng-model attribute with selenium-webdriver

ruby,angularjs,selenium,selenium-webdriver
I am using Ruby and the gem selenium-webdriver I am working with an angular form that I have no control over and would like to know how to find elements via their ng-model attributes. Here is an example select element: <select class="medium-3 small-12 columns ng-pristine ng-valid ng-touched" ng-model="ctrl.type" ng-options="type.name for...

Should I use ids to locate elements?

angularjs,selenium,protractor,end-to-end,e2e-testing
Started with Angular and Protractor. It just feels wrong to write some heavy css selectors which will break instant when you change something. Using ID's would make testing way easier. I'm not using any id attribute for styling yet. Are there any drawbacks using ids for testing I haven't considered?...

Unable to print a perticular name in selenium webdriver using java

java,html,selenium
My Java package com.ej.zob.modules; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; public class Manage_Branch { public void Execute(String IFSC) { LaunchApplication.driver.findElement(By.linkText("MANAGE")).click(); LaunchApplication.driver.findElement(By.linkText("BRANCH")).click(); LaunchApplication.driver.findElement(By.xpath("//tbody/tr/td/div[text()='"+IFSC+"']")); WebElement col =...

Select element by Class Name in a page with multiple elements - Selenium and C#

c#,selenium,selenium-webdriver
I 'm using Selenium WebDriver + C # to automate a test in a report. This report has a table with multiple columns and rows and each cell in this table has the class name composed by a name and a unique identifier (this identifier changes every time the report...

Selenium C# Element Not Found Taking a Long Time

c#,unit-testing,selenium,selenium-webdriver
I am using Selenium for C# to test a page. Is there a way to quickly fail if the element is not found on the page? I am experiencing if the HTML element is not found on the page the Selenium test a very long time and then eventually it...

WebDriver can't get dropdown menu element (Java)

java,selenium,webdriver,junit4
I write a script on Java for Selenium WebDriver, and I have a problem with selected from dropdown menu. Here's my locator: new Select(driver.findElement(By.id("FormElement_select_68_input_input"))).selectByVisibleText("Image"); Here's an error: http://prntscr.com/7jul03 Here's HTML code: http://prntscr.com/7jvou6 Need to select "Image" from this menu, but have an error. Before I had the error like this,...

Is there a different way to use methods of another class? [on hold]

java,selenium
I fixed it. I extended the AbstractPage where the methods are. At first I would get a Test class must have a singular no-Argument constructor. Then I realized that in the @Before the driver variable and startup variable made problems after I removed those and just called the open chromedriver()...

How to write xpath in selenium webdriver for below HTML expressions?

selenium
I wrote xpath for below HTML code i.e. displayed below 1. //a[@text()='Life Insurance'] 2. //span[@text()='Apply now'] But I got element not found exception. If I used Absolute xpath processor then It's working and I wrote own xpath then it thrown exception. Please tell me how to write it. Below are...

Load additional CONFIG file with values

javascript,selenium,testing,protractor,end-to-end
I am using lot's of values for my test like username and password. For this purpose I created a config file where I store just this data in JSON, it looks like: { "login": "test", "password": "pass", "number": "1234", } It works for me if I request it at start...

How to select a text from the autocomplete textbox using selenium

java,selenium,selenium-webdriver,browser-automation
I need to enter some text in a autocomplete textbox. Then I will select a option from that autocomplete option and need to click it. I have tried with the following code: public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub String textToSelect = "headlines today";...

close and open browser -selenium C# Visual studio

c#,selenium,browser,close
I want to close and then open the browser without close the driver of selenium, using C# I don't want to: driver.Quit(); How Can I close and the open again the browser Chrome?...

Java Selenium - Can't seem to select an element

java,selenium,xpath,hidden
I'm trying to select an e-mail href to grab the text, but no matter what selections I use to try to select the e-mail, my selection doesn't seem to work and I am curious what other ways might exist to fix the problem. I have used absolute and relative xpath,...

Add Httpheader to selenium chrome webdriver in C#

c#,selenium,selenium-webdriver
My C# code looks like this for creating chrome web driver, i wanted to add the custom HTTP headers to all my http requests. ex: user-agent : Android var service = ChromeDriverService.CreateDefaultService(@"c:\Chrome\"); var option = new ChromeOptions(); _driver = new ChromeDriver(service, option); We have the way for firefox, as the...

How to parse Selenium driver elements?

python,parsing,selenium,selenium-webdriver,web-scraping
I'm new in Selenium with Python. I'm trying to scrape some data but I can't figure out how to parse outputs from commands like this: driver.find_elements_by_css_selector("div.flightbox") I was trying to google some tutorial but I've found nothing for Python. Could you give me a hint?...

Selenium webdriver for handling dynamic ckeditors

selenium,selenium-webdriver
I am currently doing scraping using selenium in java for a website. Most of the pages I scrap contains ckeditor. I am currently using javascript to get the data from ckeditor using javascriptexecutor executescript method CKEDITOR.instances['locator name/id/class'].getData() but the problem here is the locator is changing dynamically I also found...

Checking element existence on the page with WebDriver findElements().isEmpty method

java,selenium,selenium-webdriver
I wish to check if some element exists on the page or not. I already saw this WebDriver: check if an element exists? issue but I'm wondering why not simply apply findElements().isEmpty method? I thought it would do the same work. UPD Now I see findElements().isEmpty works perfect so I'm...

How to get selected option using Selenium WebDriver with Python?

python,selenium,selenium-webdriver,selecteditem,selected
How to get selected option using Selenium WebDriver with Python: Someone have a solution for a getFirstSelectedOption? I'm using this to get the select element: try: FCSelect = driver.find_element_by_id('FCenter') self.TestEventLog = self.TestEventLog + "<br>Verify Form Elements: F Center Select found" except NoSuchElementException: self.TestEventLog = self.TestEventLog + "<br>Error: Select FCenter element...

Cannot interact with input (role=combobox) using Selenium WebDriver (Firefox)

java,javascript,jquery,css,selenium
I'm studying Selenium WebDriver and testing my skills on a public site. The issue is that I cannot interact with input element with role='combobox' using Selenium WebDriver + Java. I need to interact (select 2d option) for the first element of calculator ("Калькулятор"-"Тип расчета" - combobox near this text). Firefox...

CSS Selector-How to locate Parent Element

selenium,selenium-webdriver,css-selectors,webdriver
Is there any way to locate parent element in CSS Selector? i am using below code but i am not getting the parent element. WebElement we=dr.findElement(By.cssSelector("div[id='gf-BIG']:parent")); I know there is a way in Xapth but please let me know that how we can locate parent in CSS Selector. ...

how to return object from protractor

javascript,angularjs,selenium,testing,protractor
I have written following code to return text from the table. Now, I want that thing in here: dnassgn is page name, but after calling that function the return value is coming as blank. Please suggest me where I am wrong. fetch_text_from_cell_in_table: function(col_val){ var name_var=""; var km = 0; var...

How to connect nested xpaths for Selenium webdriver assert? i.e. Label and separate button in a row

java,selenium,xpath,selenium-webdriver
I am attempting to assert that a button on our page is disabled. The below HTML is what I am working with at the moment: <div data-persona-noeditable="" style="display: block;"> <div class="c-potential-tooltip persona-name pull-left" data-potential-tooltip=""> <div data-name-persona="" class="marg5" data-original-title="" title="">autoTestMapped</div> </div> <button class="btn btn-small pull-left marg5" data-copy-persona="">Copy</button> <button class="btn btn-small pull-left...