FAQ Database Discussion Community


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...

Protractor - Wait for async promise before doing next

selenium-webdriver,webdriver,promise,protractor,angularjs-e2e
First of all, I've already checked various post and blogs concerning that point and I still can't figure out how to make it correctly. I have tried many different combinaison of : browser wait protractor.controlFlow().execute protractor.controlFlow().await( ...Still no success.. My problem Within my beforeEach function, I'd like to call a...

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,...

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"...

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...

How to close an opened file without using robot

java,selenium,selenium-webdriver,selenium-chromedriver
I am using Selenium to test a website. I can upload a ".txt" file and then double click on it to open,But I am not able to close the opened file using selenium!!! I know there is a solution with robot tool by using Alt+F4 but I am not allowed...

For loop not only passing once

for-loop,selenium-webdriver
String[] expected = new String[10]; //{"Acapulco","Frankfurt","London","New York","Paris","Portland","San Francisco","Seattle","Sydney","Zurich"}; expected[0] = "Acapulco"; expected[1] = "Frankfurt"; expected[2] = "London"; expected[3] = "New York"; expected[4] = "Paris"; expected[5] = "Portland"; expected[6] = "San Francisco"; expected[7] = "Seattle"; expected[8] = "Sydney"; expected[9] = "Zurich"; List<WebElement> allOptions = driver.findElements(By.name("fromPort")); // match the fromPort list...

Same Link opening in Loop

python,selenium-webdriver
I am pretty new to Python and am trying to write a small code for testing links on a website.. I have created a dictionary as following: header_dropdown_links = { 'Features' : 'Features', 'Company' : 'Company | Values', 'Community' : 'Community | Open Sauce', 'Solutions' : 'Selenium Testing | Solutions',...

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")...

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...

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...

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...

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...

How to use for loop for varying ul & li both?

selenium,xpath,selenium-webdriver
It may be already asked question,but I am unable to find it. Below is the code I am using: List<WebElement> allElementswithLetter = Driver.driver.findElements(By.xpath("//div[contains(@class,'page-bg clearfix search-locality')]/ul[i]/li")); here ul is varying in every iteration in for loop, but my script is unable to identify it. How to solve this issue?...

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...

How to combine two urls in selenium webdriver

java,selenium-webdriver
I have declared two variable for url as below Url = vars.get("http://stackoverflow.com"); url1 = vars.get("/questions"); driver.get(Url + Url1); When I am executing it, it is opening a web browser but there is no url address in the browser and nothing is happening. Could you please let me know where I...

Chrome webdriver does not let me click a hamburger menu

selenium,selenium-webdriver
This is the appearance of the html markup (A tile like object) I am testing with selenium. The goal of the test is to trigger the drop down menu by clicking the hamburger icon as seen in the attached screenshot. Here is the relevant code dropdown_menu = tile.find_element_by_class_name('dropdown-toggle') dropdown_menu.click() When...

Error message “firefox doesn't work anymore”

firefox,selenium,selenium-webdriver
I am running Selenium Webdriver for Firefox (most recent version). Everytime I start my test, I'll get an error message from Windows itself saying Firefox crashed. When I hit the Force close-Button, the test starts as it should. I am new to Eclipse and Selenium, but in debugger mode I...

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...

I want to find the xpath for day separated by

java,html,xpath,selenium-webdriver
I have an HTML like this <td class="FormLabel" valign="top"> <span class="DataLabel">Consists of:</span> </td> <td class="FormData"> <span class="BodyText"> Sunday<br> Monday<br> </span> </td> Here I want Xpath to just check for Sunday. I had written Xpath like this //span[contains(.,'Consis')]/parent::td/following-sibling::td/span[contains(.,'Sun')] But this is not working as it is showing both days sunday and...

What can be used if I want to check if the element is present or not in selenium webdriver?

java,selenium-webdriver,automated-tests
I just want to check if the element is present on the page or not? I am confused with what can be used. What is feasible to use isDisplayed() or isPresent()? What is the difference between these two?...

How can I initialize web driver globally?

java,selenium-webdriver,nullpointerexception
I am working on automation using selenium webdriver , java. Getting nullpointerexception and it says driver is null. My code structure is given below : Package Utility Base Class Login Class App_constant Class Package Add user Add user Class Utility package code : package Utility; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public...

How to access invisible Unordered List element with Selenium WebDriver, Java

java,select,selenium,selenium-webdriver,html-lists
This is the HTML code: <ul id="personalBar"> <li id="upload" style="display:none;"></li> <li id="personal"> <span class="translate"></span> <span id="userName">qaadmin</span> <div id="dropDownArrow"></div> <ul> <li id="pendingActivities" class="translate" onclick="eCommon.helper.viewAllPendingActivities()" translatekey="MANAGE_STORE">Manage Store</li> <li class="translate" onclick="eCommon.helper.outSourceViewReports()"...

Not able to insert image after the current one in word with microsoft.office.interop.word

c#,selenium-webdriver,ms-word,office-interop
I am trying to open an existing word file and insert image into it (image name with path being passed to the function ). Code logic is working fine but challenge is every time the new image file is inserting / place on the top of the last one.mean the...

Selecting Drop Down Option using XPath & C# For An HMTL Table

c#,selenium,xpath,visual-studio-2013,selenium-webdriver
I want to choose a specific selection in this table, my table & specific selection being: <table border="0" align="CENTER"> <tbody> <tr> <tr> <td class="FieldLabel" valign="top" nowrap="" colspan="1"> <td valign="top" nowrap="" colspan="3"> <select class="HandleSelectChange" name="DISPLAY_RequestingProvider" style="width:100%;" size="1"> <option selected="" value="">Choose One</option> <option value="1134303902NMDX0NMDX0 NMDX0Company Name">Company Name -...

Python - Selenium and XPATH to extract all rows from a table

python,selenium,xpath,selenium-webdriver,web-scraping
I am using Selenium and XPATH to extract all rows from a table, but can only get the first row. Here is what I am doing: from selenium import webdriver path_to_chromedriver = '/Users/me/Desktop/chromedriver' browser = webdriver.Chrome(executable_path = path_to_chromedriver) url = "http://www.psacard.com/smrpriceguide/SetDetail.aspx?SMRSetID=1055" browser.get(url) browser.implicitly_wait(10) SMRtable = browser.find_element_by_xpath('//*[@class="set-detail-table"]/tbody') for i in SMRtable.find_element_by_xpath('.//tr'):...

Specflow,Selenium-Share data between different Step definitions or classes

selenium-webdriver,specflow
I just started using Spec flow along with Selenium & N Unit . I have a basic question, maybe I know the answer to it, but want to get it confirmed. Consider, there are 2 features - Register, Add new transaction . 2 separate features with their respective Step definitions....

Using xpath to locate element with an underline in the name

xpath,selenium-webdriver,unique
I am trying to click on a webelement that changes ID and xpath dynamically. I dont see any other information that can be used directly to identify the element uniquely everytime the page loads. Here is the Xpath for the element: .//*[@id='isc_SB']/table/tbody/tr/td This will be updated along with ID at...

Unable to trace an element by attribute or text

java,testing,selenium-webdriver,webdriver
I am having trouble with clicking at an element of a menu which is written like this: <div class="menu"> <ul class="tabs ctrlTabsProfile"> <li class="active" data-tab="tabDetail">User Details</li> <li data-tab="tabEmail">Email</li> <li data-tab="tabPass">Change password</li> <li data-tab="tabAdress">Account Details</li> </ul> </div> I have tried these: driver.findElement(By.linkText("Account Details")).click();...

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,...

Creating a Selenium getText() method for an element?

javascript,selenium,selenium-webdriver,webdriver
I am trying to create a Selenium getText() method that gets either the node text OR gets the node+child text of an element. By default, the Selenium behavior seems to use the Xpath .//string() method of getting text and including the text of immediate children. I want to take advantage...

Difference running Protractor with/without Selenium?

google-chrome,firefox,selenium,selenium-webdriver,protractor
Checking the protractor documentation, I see there is a option to run protractor without using Selenium server using directConnect: true flag. What is the difference between running protractor tests with a selenium server and without a selenium server other than the fact that only Chrome, Firefox are supported for the...

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...

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";...

OutOfBoundsException - Why?

java,selenium-webdriver
I've had a read on the forum around OutofBoundException error but I am still none the wiser on my issue unfortunately. String[] expected = new String[10]; //{"Acapulco","Frankfurt","London","New York","Paris","Portland","San Francisco","Seattle","Sydney","Zurich"}; expected[0] = "Acapulco"; expected[1] = "Frankfurt"; expected[2] = "London"; expected[3] = "New York"; expected[4] = "Paris"; expected[5] = "Portland"; expected[6] =...

Screen capture error - what does it mean?

python,selenium,selenium-webdriver,screenshot
I'm using this call: driver.save_screenshot('/tmp/screen1.png') Which results in this error: selenium.common.exceptions.WebDriverException: Message: Could not convert screen shot to base64 - Error: Unable to load canvas into base64 string I can't find any information on this error....

Selenium Webdriver - Cannot click button - Finds element

java,selenium,selenium-webdriver,webdriver
Hopefully someone can help me with a solution to my problem. I have spent the better part of the day trying nearly every solution I can find on here and through Google. I will cut to the chase. I have a test that logs in on one screen. The second...

Force close webdriver despite of any alerts

selenium-webdriver
Is there a way to force close a webdriver inspite of any alerts present? I know that I can close any alerts using the Alert api, but the issue is that I don't know what other situations which may cause webdriver to be blocked. At present it hangs on an...

Testing Annotation

java,selenium-webdriver,maven-2,testng
I have about 50 testcases in 1 testclass and some are dependant testcases. I struggled to use testng annotation to make them run the way I want. I want the output of the test to be: run1, run 2, run 3, run 4, run 5, run 6, run 7, run8....

Selenium test execution via jenkins on linux box

linux,selenium,jenkins,junit,selenium-webdriver
How to run selenium webdriver scripts via jenkins on linux machine and publish the test results in Jenkins? I am using Jenkins as my Continuous integration tool. Jenkins is running in linux machine. I need to run the Selenium test suite during build process in jenkins and publish the results...

not able to automate drop down as while selecting one value gets auto picked,so second one is not visible

java,selenium,selenium-webdriver,xpathnavigator
I am trying to automate below website drop down: https://qa.roofandfloor.com/ In the city section,we have both bangalore and chennai,suppose bangalore gets autoselected,so running below code is failing: WebElement element=driver.findElement(By.xpath("//select[@class='city-dropdown-search form-city hide select2-offscreen']")); Select se=new Select(element); se.selectByIndex(2); its not able to recognise second city,please help me whats wrong I am doing...

Protractor map function returning undefined

javascript,selenium,testing,selenium-webdriver,protractor
Given an app with multiple widgets on it, each with their own title and whatnot, I would like to map each widget's elements, to make them easy to handle in tests. For example, a page: this.widgets = element.all(by.css('ul.widget-grid')).map(function(widget, index) { return { index: index, title: widget.element(by.css('div.title')).getText() }; }); And then...

how to locate the following HTML in selenium web driver?

java,html,selenium-webdriver
I have tried using class Name but it doesn't seem to be working . How can I select update using span tag ? <span class="ui-button-text">Update</span> ...

Timeout for webdriver.PhantomJS in python?

python,selenium,selenium-webdriver,phantomjs
I just use selenium-python. When I use webdriver.Firefox(), I can get the result. When I use webdriver.PhantomJS(), the result can't be returned (the script is hanging). Can anyone help me? browser = webdriver.PhantomJS(executable_path='./lib/phantomjs/phantomjs') url = "http://aminer.org/search/jie%20tang" browser.get(url) ...

How to access second element using relative Xpath

firefox,xpath,selenium-webdriver,selenium-ide,robotframework
Given this page snippet <section id="mysection"> <div> <div> <div> <a href=""> <div>first</div> </a> </div> <div> <a href=""> <div>second</div> </a> </div> </div> </div> </section> I want to access the second a-element using relative Xpath. In FF (and locating with Selenium IDE) this //section[@id='mysection']//a[1] works but this does not match //section[@id='mysection']//a[2] What...

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'"...

How to handle “Violation of UNIQUE KEY constraint” exception in asp.net web application

c#,c#-4.0,selenium-webdriver,c#-3.0
<AlternatingRowStyle BackColor="#F7F7F7" HorizontalAlign="Justify" Wrap="False" /> <Columns> <asp:CommandField ShowDeleteButton="True" ButtonType="Image" /> <asp:CommandField ShowEditButton ="True" ButtonType="Image" /> <asp:TemplateField HeaderText="Name" SortExpression="Name"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server"...

Get row of database(phpmyadmin) datatable using selenium webdriver

selenium-webdriver
I am new to selenium driver . How to get data of row from database table. I tried this code where my database name is "demodatabase" , table name is "state" and row id is 2 package com.db; import java.sql.Array; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;...

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.

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...

Manage selenium test project

java,selenium-webdriver
I have general questions about Managing selenium web project, the example is below, my question is how to manage those test cases?(its only 3 for the example, the real number of test cases is more than 1000) Did create class for sub tests is good, like class for login and...

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?...

How to set the IEDriverServer.exe through command line in protractor

internet-explorer,selenium,selenium-webdriver,webdriver,protractor
I would like to set the IEDriver executable path via command line while using protractor. I am using the following command, but it is not considering path to the IEDriver executable. cd > protractor --seleniumArgs "['-Dwebdriver.ie.driver=../selenium/IEDriverServer.exe']" conf.js I am getting the error: var template = new Error(this.message); ^ UnknownError: The...

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"...

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"...

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);...

PhantomJS load same page multiple times does not work, cannot clear cache

java,selenium-webdriver,phantomjs,load-testing
I am trying to use PhantomJS for load testing website, but I am facing this problem, PhantomJS just loads website once, after that it does not actually hit it, I see that there are many discussion for people asking this feature for load testing purpose but looks like its not...

Login to reddit using selenium python

python,selenium,selenium-webdriver
I am trying to login to reddit.com using selenium python. Username field is filled properly but the password field is not filled right. My password is 10 digits long but in the password field of reddit, it is only filling 8 digits. I don't know what's wrong. Help is appreciated....

using for loop for a textbox in selenium C#

c#,visual-studio-2013,selenium-webdriver
for(int i=0;i<=10;i++) { Driver.Instance.Find Element(By.Id("id of element")).Send Keys("auto"+i); } I used this code but it does not work 1 to 10 numbers are printing in one attempt I am searching for the code which dynamically increment in each run with out changing the sendkeys values again and again...

Find checkbox and add text

java,selenium,selenium-webdriver
I would like to add in the secondary text field at this website a text string. My selenium method looks like the following: public void addSecondaryText(String string) { //click secondary button WebElement secButton = driver.findElement(By.xpath("//label/input[@id='sub-text-check']")); if (secButton.isDisplayed()) { secButton.click(); } //clear text WebElement secTextField = driver.findElement(By.xpath("//*[@id='sub-text']")); secTextField.clear(); // I get...

Webdriver Script is working fine in all other's browsers but not working in IE11

selenium,selenium-webdriver,webdriver
As my webdriver script is working well in Chrome, Firefox, Opera, Safari. But when I run this script in IE11 than it only opens the webpage after that it can't do any other functionality. Please Help me and tell me what's wrong with it. I am using IE11 webdriver 64...

Get the index number of first and last options listed in drop down menu

java,selenium,selenium-webdriver
I have to find the options listed first and last in a dropdown menu using selenium webdriver. li class="dropdown location" ul class="select" <li> class="dropdown location" <ul> class="select" <li> data-site="http://www.example.com" value="ES">Europe</li> <li> data-site ="http://www.example.com" value="SG">Singapore</li> There are more than 50 options. I wanted to find the index number of Singapore. Is...

Selenium Firefox webdriver does not adopt profile

python,firefox,selenium-webdriver
I have created a FF profile: fp = webdriver.FirefoxProfile() fp.set_preference("browser.download.dir", CLIENT_SAVING_DIR) fp.set_preference("browser.download.folderList",2) fp.set_preference("browser.download.manager.showWhenStarting",False) fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream") Then pass this profile to remote mode webdriver: remoteHost="192.168.x.y:4444/wd/hub" driver = webdriver.Remote(remoteHost, desired_capabilities=DesiredCapabilities.FIREFOX, browser_profile=pf) I've...

Python Selenium: find element for favorite/unfavorite button

python,selenium,selenium-webdriver,favorite
I'm trying to find all elements on a page that have not already been clicked, or 'favorited.' Here is the html for an element that is favorited: <a class="button-fave unfavorited-button favorited-button" rel="78853399" alt="Add to favorites"> <div class="button-spinner"></div> <span class="status-text">Favorite</span> </a> Here is the html code for when the element is...

Difference between BeforeClass and BeforeTest in TestNG

selenium,selenium-webdriver,testng
As we know from official TestNG documentation: @BeforeClass: The annotated method will be run before the first test method in the current class is invoked. @BeforeTest: The annotated method will be run before any test method belonging to the classes inside the <test> tag is run. Both the above testng...

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...

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...

Developers tool(F12) is opening in Internet Explorer when it is launched by watir-webdriver

internet-explorer,selenium,selenium-webdriver,watir-webdriver,developer-tools
I am automating a web application on Internet Explorer using Watir-webdriver and ruby. When I run my script in my Laptop[Win7(x64) and IE11] it is running without opening Developers Tool in Internet explorer. But When I test the same script in Virtual Machine[Win8(x64) and IE10], Intenet Exploerer browser opening with...

Interact with a file_field inside span - Watir/Selenium-Webdriver

ruby,selenium-webdriver,watir-webdriver
How do I interact with a file_field thats hidden by its parent? <span class="btn button-large fileinput-button"> Select files... <input accept="image/png, image/gif, image/jpeg" id="gallery_files" multiple="multiple" name="gallery_files" type="file"> </span> The button overlays the input, therefore it's not visible. Edit For the record, here's my code: data[:photos].each do |photo| $browser.file_field.set photo end and...

How to select Autogenerated web element

selenium-webdriver
I have this xpath //*[@id="s2id_autogen8"] After Refresh Xpath gets change. Can someone please advise how can I create customized XPath for this. HTML Code: <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input select2-default" id="s2id_autogen38" style="width: 220px;"> ...

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?...

Not able to select option from dropdown box in an android mobile application

python-2.7,selenium-webdriver,appium
I have to automate payment gateway process for my native android application for which i have to select option from dropdowon box. After selecting an option "continue" button will be enabled. On clicking continue button it takes me to new screen where payment details will be entered. I'm facing following...

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 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...

AndroidDriver constructor rises NullReferenceException

c#,android,selenium-webdriver,webdriver,appium
I use Appium server running on Mac machine and AppiumDriver with c# bindings to execute tests from Windows machine. The issue is that when I create an instance of AndroidDriver its ctor rises a NullReferenceException. When I create an instance of RemoteWebDriver, it works smoothly. This is my code: var...

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")...

Selenium + Python - how to get the response from the site after uploading an image

python,selenium,selenium-webdriver
I'm trying to upload images to Microsoft's http://how-old.net/ API to compare with our age and gender classification algorithm [1]. I've managed to upload images to the site, but I can't figure out how to get the response (i.e. age and gender classifications). Here is my code: from selenium import webdriver...

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...

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 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...

Moving through mutiple iFrames using XPath & C#

c#,html,iframe,xpath,selenium-webdriver
I need to get a data element out of a table, which is nested within two iframes. The frames appear as: <iframe id="appContent" frameborder="0" name="appContentFrame" src="/controller.aspx" style="height: 0px; width: 1319px;"> //.... <iframe id="childFrame" frameborder="0" src="javascript:"";" onload="AjaxDocument.registerFrames('childFrame');" name="childFrame"> I am trying to select both of the frames by using: driver.SwitchTo().Frame("appContent"); driver.SwitchTo().Frame("childFrame");...

The given selector Comments button is either invalid or does not result in a WebElement

selenium,xpath,selenium-webdriver
My Selenium server generates following error when trying to access a dom element with Xpath //*[@id="someid"]/div/div/div/a. WARN - Exception: The given selector Comments button is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression Comments button...

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{...

Autocreate nested foreach statement

c#,selenium-webdriver,foreach,iterator,auto
I have a simple scenario I am trying to workout which involves auto creating nested foreach statements. What the method is to do is take the int value passed into the method and based on this, it should automatically create nested foreach statements. public static String[] ValuesAdd1 = { "a",...

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...

better way to automate a multiple searchbox using selenium

selenium,selenium-webdriver,automation,automated-tests
i have to automate search option in below url : https://qa.roofandfloor.com/ currently,I am selecting single dropdown one by one and searching properties and automating it,just wondering if there is more better/effective way to automate it. can someone help me on this design pattern. i know its mostly a theoretical issue,but...

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...

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 retrieve a partial text from a website using selenium

selenium-webdriver
I am using selenium with both firefox and chrome and I was wondering on how to be able to get a certain part of a text and only that part. <div align="center"> Your PR application has been submitted sucessfully. <br> Application Number :PR_____ <br> PR number : _____ </div> what...

How to identify an element via XPath when IDs keep changing

html,xml,xpath,selenium-webdriver,web-scraping
I am using a website, where the values of the elements are changing dynamically every time the elements load. The id's are dynamic and so is the XPath. I don't seem to have any unique identifier to locate the elements. Please advise on the best way to uniquely identify the...

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...

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 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...

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...

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() ...

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. ...

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...

Is it possible to resolve promise within the 'executeScript'?

javascript,selenium-webdriver,jasmine,protractor,webdriverjs
I am trying to write my first test using Protractor+Jasmine for my non Angular application. I need call API function of my app global instance, get result and compare it in test. One of passed in parameters for this function is a callback which is called as soon as data...

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"...

Unable to identify the login button for naukri.com application using selenium Webdriver

java,selenium-webdriver,automation
I am trying to automate the naukri.com application and as a part of that when I launch the site it basically displays some set of pop up windows which needs to be closed before I proceed to login to the application.This specific functionality has been handled by the code where...