FAQ Database Discussion Community


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

What line is causing this Protractor error?

error-handling,webdriver,jasmine,protractor,end-to-end
Is there a way for Protractor to show in the console log what line the error occurred on? I just get this type of message: Message: Failed: Cannot call method 'click' of undefined Stack: Error: Failed: Cannot call method 'click' of undefined at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:104:16 at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15 at [object Object].webdriver.promise.ControlFlow.runInNewFrame_...

Image upload with selenium webdriver

selenium,webdriver
Using selenium web driver with java. I have an image upload control using which i need to upload an image. I have tried .sendKeys method by passing image path that didn't work. I have tried robot class, first clicks the button that opens a Window (windows native window) but it...

Watir-Webdriver Control Android ChromeDriver on Android Device

android,selenium-webdriver,webdriver,watir-webdriver,selenium-chromedriver
I downloaded ChromeDriver https://sites.google.com/a/chromium.org/chromedriver/downloads and put it in my platform-tools folder within the Android SDK folder. I have my phone connected and it appers to be setup correcly, when I run ./chromedriver it says $ ./chromedriver Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 9515 Only local connections are allowed. However how...

Selenium webdriver selecting new window c#

c#,selenium,selenium-webdriver,webdriver,popupwindow
Trying to write some test cases using selenium webdriver in c# and have a scenario which i'm unsure of how to resolve user scenario is searching a table for a patient, select a patient then a new window opens and then assert various items on the window my issue is...

Stay on a page for 30 minutes ,then perform a operations (Webdriver-Java)

selenium,selenium-webdriver,webdriver
I have a scenario where I login to an application, perform a download operation then wait (stay) on that page for 30 minutes, then again perform the download operation. Is implicitwait for 30 minutes is feasible in the scenario? Is there any better option?...

Webdriver access data-interchange element

java,groovy,selenium-webdriver,webdriver
I've a quick question...well what I hope will be a quick questions. I have a div element which looks like the following: <div class="slideshow-image" data-thumb-index="0" data-interchange=" [//someURL/5/568/1_40.jpg, (default)], [//someURL/5/568/1_40.jpg, (small)], [//someURL/5/568/1_70.jpg, (medium)], [//someURL/5/568/1_base.jpg, (large)] " data-uuid="interchange-i9a0pkp20" style="min-height: 527px; background-image: url(http://someURL/5/568/1_base.jpg);"> <div class="pageheader-overlay"></div></div> Now through...

Selenium/Webdriver tests execution time doubled after upgrading to 2.45

selenium,selenium-webdriver,webdriver,automated-tests,selenium-firefoxdriver
after the upgrade from selenium 2.44 to 2.45 the execution time is 2-3 times longer than before. I have been executing the tests with Firefox 36 in a Linux/Ubuntu and a Windows XP environment. What could be the reason behind this slower speed? Do I have to configure FirefoxDriver differently...

How can I go to the given URL in mobile Chrome browser using c# and appium on real device?

c#,android,webdriver,appium
I'm automating mobile web testing on Android real device with Appium and c#. I've seen that there is get method in Java that allows navigation to the given URL, for example: DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setPlatform(Platform.ANDROID); capabilities.setCapability("device", "android"); capabilities.setCapability("app", "chrome"); driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.get("http://www.google.com"); System.out.println("Android Title...

For loop for Checking list of items in Selenium WebDriver

java,selenium,selenium-webdriver,webdriver
I have written below code for Checking list Web Elements, but below code is running but for only 1st item its no looping to end of loop. List <WebElement> listofItems = wd.findElements(By.xpath("//*[starts-with(@id,'result_')]//div//div[1]//div//a//img")); for (int i=1; i<=listofItems.size(); i++) { listofItems.get(i).click(); wd.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); System.out.println(i); System.out.println("pass"); wd.navigate().back(); } ...

How can I run Protractor tests on a remote machine

selenium,webdriver,protractor,invoke-command
I want to run my protractor tests on a virtual machine. I already tried running it with the following command: Invoke-Command -ComputerName 10.2.1.7 -Port 5985 -Credential $credential -ScriptBlock{ protractor C:\Users\test\Desktop\proRemote\config.js } Unfortunately this approach is very slow. Is there another way to run my protractor tests on a virtual machine?...

Check if some text exists on the webpage using getPageSource. I get error Object has no attribute getPageSource

python,selenium,selenium-webdriver,webdriver
I am trying to verify some text e.g. "test001" on a webpage using driver.getPageSource in Python, Webdriver. I get the error object has no attribute 'getPageSource': Traceback (most recent call last): File "C:\Users\riaz.ladhani\PycharmProjects\Selenium Webdriver\ClearCore \TestCases\AdministrationPage_TestCase.py", line 32, in test_add_Project administration_page.add_project() File "C:\Users\riaz.ladhani\PycharmProjects\Selenium Webdriver\ClearCore \Pages\admin.py", line 43, in add_project test =...

Selenium AssertText

selenium,selenium-webdriver,webdriver,assertion
I want to assert that a string of text is present on a page before moving on and am having trouble. I am using Selenium Webdriver with Java. Here is the code I've tried: String str2 = driver.findElement(By.id("ctl00$MainContent$cklRepair$10")).getText(); Assert.assertTrue(str2.contains("text"), "Lubrication"); and boolean textFound = true; try { driver.findElement(By.id("ctl00_MainContent_cklRepair_10")); textFound =...

Capybara: How to fill a textarea without an 'id'?

ruby,selenium,selenium-webdriver,webdriver,capybara
I am in need to fill_in a textarea which does not have an id. Following the inspection: <textarea class="stock-description-input js-short-description-textarea" placeholder="Select a product or enter a description" maxlength="64"></textarea> Have you got an idea how to do it?...

Need to select specific element using XPath in Selenium Webdriver using Java

selenium,xpath,selenium-webdriver,webdriver
I have a problem that I just can't find the answer to. I'm usually good in selecting specific elements in this spaghetti digit code. This time I'm stumped. Here is the code... <div id="widget_dijit_form_DateTextBox_0_dropdown" class="dijitPopup dijitCalendarPopup" style="visibility: visible; top: 179.55px; z-index: 1000; left: 217.9px; right: auto; display: none;" role="presentation" dijitpopupparent="dijit_form_DateTextBox_0">...

How to add a screenshot to allure report with python?

python,webdriver,py.test,allure
i have this code: # coding: utf-8 from selenium import webdriver import pytest import allure @pytest.yield_fixture(scope='session') def driver(): _driver = webdriver.PhantomJS() yield _driver _driver.quit() def test_ya(driver): with allure.step('open ya.ru and take screenshot'): driver.get('http://ya.ru/') allure.attach('screenshot', driver.get_screenshot_as_png(), type='png') and with this one i try to take a screenshot and save it to...

Is it a good idea to iterate through several browsers in one test using Selenium WebDriver?

loops,testing,selenium,webdriver
I am trying to run a simple test on multiple browsers, here is a mock up of the code I've got: String url = "http://www.anyURL.com"; WebDriver[] drivers = { new FireFoxDriver(), new InternetExplorerDriver, newChromDriver() }; @Test public void testTitle() { for (int i = 0; i < drivers.length; i++) {...

How do I detect and wait for an overlay in Selenium WebDriver?

php,selenium,selenium-webdriver,webdriver
There is a spinner overlay that appears on top of page and I must wait for it to finish loading. After it goes away, then I can click elements. However, when I perform a test to see if the element is clickable, it always returns true. I have to manually...

Error - First chance exception occured in webdriver.dll

selenium,xpath,webdriver,internet-explorer-9
I have a selenium project setup in visual studio 2010 and while debugging , I am getting first chance exceptions in webdriver.dll with additional information: unable to find xpath ==.//[@id='menuForm:projectMenu_span'] As the error says clearly,it was unable to locate the element with xpath. I used firebug to get the xpath....

how to insert value in multiple text box in selenium webdriver

java,selenium,webdriver
This is my java code package com.ej.zob.modules; import org.openqa.selenium.By; public class SetExchange { public void Execute(String CountryName, String value) { LaunchApplication.driver.findElement(By.linkText("SET")).click(); LaunchApplication.driver.findElement(By.linkText("EXCHANGE RATE")).click(); //LaunchApplication.driver.findElement(By.id("new_Afghanistan_AFN")).sendKeys(value); LaunchApplication.driver.findElement(By.xpath("//input[@maxlength='4']")).sendKeys(value);...

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

Python Webdriver how to handle a browser pop up. It is not an alert generated by JavaScript

python,selenium-webdriver,webdriver
I have come accross a pop up while my Python Webdriver script was executing. Scenario: User can click Add project button from the Admin page and enter a project name etc click Save. If the project already exists a pop up is shown to say project with this name already...

Abbreviated definition of a webdriver html element

c#,webdriver,pageobjects
In webdriver, with c#, you can define a html element using this: //Textfields public static IWebElement userFieldElement { get {return Configuration.driver.FindElement(By.XPath(".//input[@name='USER']"));} } Is it there an abbreviated way of defining the same? I have tried: public static IWebElement passwordFiedfElement = Configuration.driver.FindElement(By.XPath(".//input[@name='USER']")); But it is invalid because webdriver tries to find...

How to control Firefox extension's sidebar using Webdriver

node.js,firefox,selenium,selenium-webdriver,webdriver
I am attempting to test a Firefox extension using the relevant driver provided by the selenium-webdriver NodeJs package. The extension creates a sidebar whose handle I haven't been able to find using the getAllWindowHandles method. Having spent some time reading the documentation it also seems that Selenium doesn't support tabs;...

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

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

selenium - internetexplorerdriver compatibility mode

c#,selenium,webdriver,nunit,compatibility-mode
Is there any way how to force webdriver/internetexplorerdriver to open a site in compatibility mode. Every time I run my tests by Nunit all the history and compatibility mode list (where was my site listed before) are cleaned. I can't change the code of the site. Can I add item...

How to make Selenium WebDriver wait for page to load when new page is loaded via JS event

selenium,webdriver
I'm working on automating a site which has a number of links which load new pages via a JS event. Basically, there are elements which are clickable, clicking on one causes some JavaScript to run and this leads to a form being submitted and routing to a new page. Now...

What is the difference between findElement(By) & findElementBy()?

selenium,selenium-webdriver,webdriver
WebElement p1 = (new FirefoxDriver()).findElement(By.xpath("//div[@class = 'site-title']")) ; WebElement p2 = (new FirefoxDriver()).findElementByXPath("//div[@class = 'site-title']") ; I m doing same thing: I select element by xpath, but in first line, I do it using findElement(By.xpath) and 2nd I use whole expression findElementByXpath. and I still use same firefox driver object!...

How do I print using getText from a page object model with log4j?

java,selenium,selenium-webdriver,log4j,webdriver
I am coding some automated tests using the Selenium Webdriver in Netbeans. I have a pretty simple test, and I am implementing page objects. My trouble is here: I previously had this code: //Click the Timing Parts subcategory WebElement PartSubcategory = driver.findElement(By.xpath("//label[contains(.,'Timing Parts & Camshafts')]")); PartSubcategory.click(); logger.info("Found subcategory: "+PartSubcategory.getText()); And,...

How to select Chrome extensions to enable when using Selenium [duplicate]

python,selenium,google-chrome-extension,webdriver,web-testing
This question already has an answer here: Using Extensions with Selenium (Python) 1 answer I am using Selenium web driver to develop an automated test using Chrome as my browser. I am using Python for this. I have an extension on my Chrome browser that I would like enabled...

selenium java. Unable to locate element

java,selenium,selenium-webdriver,automation,webdriver
Please can someone point me to the right direction with below code? driver.findElement(By.id("div#h4clock a.location").equals("London")); I used getText("London") but it did not work. I am quite new so any advise would be very much appreciated. I also want to have a string to store the element London and display it using...

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

I am using unittest.TestCase if i have more than 1 test case it will not run. Only 1 test case runs

python,testing,selenium-webdriver,webdriver,python-unittest
I am automating our website. I am using Python, Webdriver, unittest.TestCase. I had 1 test method defined in my Login Page class which is to test a valid user log in. That works fine. Now i am adding a 2nd test method called test_login_invalid_user to test an invalid user log...

JMeter Webdriver Sampler it opens the browser but won't go to the URL

webdriver,jmeter,jmeter-plugins
I am doing a load, performance test on our website & i have found I can use the webdriver sampler which will simulate the user experience of interacting with the website whilst the server is under load, hence measuring the real user's experience at the same time. Also I cannot...

Codeception: Webdriver could not be found and loaded

selenium,webdriver,yaml,codeception
I am having some issues running Codeception with Selenium on Windows 8 at my new job. I get this error: [Codeception\Exception\Configuration] Webdriver could not be found and loaded. I started the Selenium server manually like I described last time in this post: Web Driver Curl Exception Anyone have any ideas...

Java Selenium WebDriver IE 9 - NoSuchElementException WARNING:The Server did not provide any stacktrace information

java,webdriver,nosuchelementexception
Using Selenium 2.45 and IE 9 Chrome and Firefox operate correctly within the Cross Browser tool but IE 9 is throwing this error. I have updated the Security Settings and Ensured all were Enabled and Set to the same security setting. I have also updated the Status bar to 100%....

WebdriverWait is showing TimeoutException, if i use sleep.time it works ok

python,selenium,selenium-webdriver,webdriver
I want to use WebdriverWait for when clicking elements in Python Webdriver. I get the following TimeoutException error when using WebdriverWait: Traceback (most recent call last): File "C:\Users\riaz.ladhani\PycharmProjects\Selenium Webdriver\ClearCore\TestCases\AdministrationPage_TestCase.py", line 30, in test_add_Project administration_page = login_page.clickAdministration() File "C:\Users\riaz.ladhani\PycharmProjects\Selenium Webdriver\ClearCore\Pages\login.py", line 46, in clickAdministration WebDriverWait (self.driver,...

How to improve Sauce Labs test execution speed for watir+ruby+rspec via Jenkins? [closed]

ruby,jenkins,webdriver,watir-webdriver,saucelabs
I have a problem when I run tests on Sauce Labs using watir + ruby + rspec via Jenkins CI. The entire test suite executes very slow. How can I improve the execution speed?

FireFox doesn't switch to a non-angular popup window by Webdriver JS (via Protractor)

javascript,node.js,webdriver,jasmine,protractor
i can't switch windows during my testing by Selenium Webdriver using Jasmine JS On FireFox browser (latest v) Runner: Protractor JS Platform: Selenium Webdriver on Node.JS Code framework: Jasmine JS The code is below: describe('LiveSite Portal - Client pay by PayPal', function() { afterEach(function () { browser.ignoreSynchronization = false; });...

Find text with Selenium in Chrome

selenium,xpath,selenium-webdriver,webdriver
How can I get the text 200 in this case: <p style="margin:0"> You can get <big class="tooltip">200</big> more</p> I'm trying using: ReadOnlyCollection<IWebElement> list = _driver.FindElements(By.XPath("//*[contains(@class, 'tooltip')]")); But can not get the text because the .Text property returns an empty string :( Any thoughts?...

How to read javascript variable using Selenium?

javascript,c#,selenium,selenium-webdriver,webdriver
I'm learning to read javascript variable using Selenium WebDriver (latest version). Sometimes it works, sometimes not. Below is my try on whoscored.com and it keeps showing error using (IWebDriver driver = new ChromeDriver()) { driver.Navigate().GoToUrl("http://www.whoscored.com/Regions/81/Tournaments/3/Germany-Bundesliga"); var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30)); var tournament = wait.Until(ExpectedConditions.ElementExists(By.Id("tournament-fixture-wrapper"))); IJavaScriptExecutor js = driver as...

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

Issue with select tag in IE with Protractor

angularjs,internet-explorer,selenium,webdriver,protractor
I have protractor tests running with Selenium using the IEDriverServer (32 bit). I am having a few issues with <select> tags not being clicked and revealing their options. Here is my conf.js: exports.config = { // The address of a running selenium server. seleniumAddress: 'http://localhost:4444/wd/hub', // Capabilities to be passed...

Cannot find element and get text using Selenium WebDriver

html,selenium,webdriver
I'm trying to find element so that I can grab text and save it as a string using selenium webdriver however I'm getting a no such element exception. JAVA: WebDriver driver = new ChromeDriver(); driver.get("https://ld2025.wdf.sap.corp/sap/bi/launchpad/#item_type=HANALYTIC"); try{ Thread.sleep(10000); }catch(InterruptedException e){ System.out.println("got interrupted!"); } WebElement searchBox = driver.findElement(By.xpath("//*[@id='itemNameLbl_608963021']")); searchBox.click(); driver.switchTo().defaultContent(); try{ Thread.sleep(15000);...

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

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

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

org.openqa.selenium.remote.SessionNotFoundException for ChromDriver

java,google-chrome,selenium,selenium-webdriver,webdriver
I am trying to execute some test cases using crome driver but out of 4 test cases only 1 is getting executed and for rest of the three i am getting SessionNotFoundException. I searched for the similar question on the portal but all of them are related to Internet Explorer...

Selenium: element.clear() triggers javascript before sendKeys()

java,selenium,webdriver
I have an input field that should contain a date. Suppose the form is loaded with a value inside of the field, e.g. "2015/04/28". I'm using webdriver to select the element using By, then I do: element.clear(); element.sendKeys("2015/04/29"); Unfortunately when I clear the element, it triggers some javascript that loads...

undefined property 'bind' when using expected conditions

javascript,angularjs,webdriver,protractor
I'm trying to use the expected conditions function to make protractor wait for the presence of items on a page before continuing. http://angular.github.io/protractor/#/api?view=ExpectedConditions I have followed the example in the docs, but I am getting an error about an undefined property. This seems to be the case when using any...

Get Selenium WebDriver locale

java,selenium,webdriver,locale
How can I get current browser locale from WebDriver? There is the way to set locale, e.g. FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("intl.accept_languages", "en"); m_webDriver = new FirefoxDriver(profile); But the problem is that it doesn't always work for some reason (not sure, but seems it doesn't work for Windows 8)....

Geb. Access head element contents (script/stylesheet/title…)

testing,webdriver,geb
I'm trying to get contents of head section of my page. I use selector which returns correct tree node and I can traverse it and get tagNames/attributes, but all texts seems empty. For the html: <head> <script>alert("MSG")</script> </head> $("head").children()*.text() // all empty assert $('head script').text() == "" // assert true,...

Automate a button click on chrome://extensions page using selenium webdriver

selenium,selenium-webdriver,webdriver,selenium-chromedriver
I'm trying to write an automated test that will automate the process of updating a google chrome extension. I'm not aware of another method of doing this automatically so here is what I'm currently trying to do: Open the chrome extensions page (as far as I'm aware this is just...

My method to find element by xpath using Contains text in try catch block is returning false

python,selenium,selenium-webdriver,webdriver
I am using Webdriver with Python I have a method which checks if the project name on the webpage contains an expected value. My method is returning false. I was expecting it to return true. I am using the following xpath to check if an element contains the project name...

Internet Explorer WebDriver Null Pointer Exception [closed]

java,internet-explorer,selenium,nullpointerexception,webdriver
I am trying to run a test using the cross browser tool (using FF, Chrome and IE). FF and Chrome work fine, but i can't get Internet Explorer to work, it keeps giving me a null pointer exception (images included). So far I have tried using IE 11 backing up...

Is there a Selenium WebDriver available for the Microsoft Edge browser?

selenium,selenium-webdriver,webdriver,microsoft-edge
As of the date of this post the name "Microsoft Edge" has just been officially announced as the default browser for the new Windows 10. It may be premature to ask but I would like to know if a new Selenium WebDriver is available for it and if not, if...

How to manipulate verification on “text” in Webdriver by Jasmine JS?

javascript,node.js,webdriver,jasmine,protractor
I've already tried a lot of codes but nothing passed the tests. Usually the test is fail when it tried to read this verification or it receive "false" instead of "true". All the script is below: describe('LiveSite Portal - Client share a document ', function() { it('LiveSite - Home Page',...

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

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

How do I return the text of an alert in Protractor?

angularjs,webdriver,protractor
I have a test that fills out a create customer page. Upon clicking save, an alert pops up with the newly generate guid of the customer. I'm trying to make a function that clicks save, captures the alert text, and then returns it to my protractor test to use later....

Unable to pass WebDriver object to factory method in TestNG

java,selenium,webdriver,testng
I hope the day finds you well. I'm still getting comfortable with Selenium and TestNG (and Java in general) and I'm just getting into some of the more interesting stuff. I'm trying to create tests dynamically using a factory but I'm not able to get the factory to take accept...

In my date time value I want to use regex to strip out the slash and colon from time and replace it with underscore

python,regex,selenium,selenium-webdriver,webdriver
I am using Python, Webdriver for my automated test. My scenario is on the Admin page of our website I click Add project button and i enter a project name. Project Name I enter is in the format of LADEMO_IE_05/20/1515:11:38 It is a date and time at the end. What...

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

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

Why can't I use the standard CSS annotation using the '#' symbol to grab elements with IDs on Selenium Webdriver, using the @FindBy annotation?

selenium,css-selectors,webdriver
Given an element on a web page that has an id: id="j_idt74:addNewTypeBtn" I'm using the '@findBy' annotation way of grabbing web page elements. Using: @FindBy(how=How.CSS, using="input#j_idt74:addNewTypeBtn") WebElement mAddButton; Gives an error: 'The given selector input#j_idt74:addNewTypeBtn is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError:...

Create FullPage Screenshot WebDriver

selenium,selenium-webdriver,webdriver
Does someone knows a way to create full page screenshots using WebDriver? I want if one of my tests fails to create a FULL PAGE (even the not visible part on the screen) screenshot before the browser close and save it on share location. Also, if it is possible I...

XPATH and text of the elements are constantly updating, what is the best way to identify an element

selenium,xpath,selenium-webdriver,webdriver
Here is the XPath for element x the first time a page loads: .//*[@id='001g000000YJnpR_00Nb0000004Lzej_body']/table/tbody/tr[3]/td[3] text on this page is: "text1". Here is the XPath for same element x the second time it loads: //*[@id="001g000000YJnm8_00Nb0000004Lzej_body"]/table/tbody/tr[3]/td[3] text on this page is: "text2". Element doesn't have a name or id and here is...

WebDriver - How to make the webdriver to wait until text displayed (without using locator)

java,selenium,webdriver
I have performed an action on WebDriver (Say, I clicked a button), resultant is a text will display on page. We do not know locator element for the text, but we do know what text will display. Please suggest a way to wait for the text to display. I have...

Error forwarding the new session: Selenium Grid 2

selenium,selenium-webdriver,webdriver,selenium-grid,remotewebdriver
I have taken latest Selenium Server which is 2.45.0 from here. Followed the documentation and started the hub with the following command java -jar selenium-server-standalone-2.45.0.jar -role hub -hubConfig HubConfigFile.json And, the JSon file content is: { "host": 10.5.0.21, "port": 4444, "newSessionWaitTimeout": -1, "servlets" : [], "prioritizer": null, "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent":...

How can I handle alerts that occur on page navigation with WebDriver?

selenium,selenium-webdriver,webdriver
The scenario here is that certain pages I'm testing will have an unload event - i.e. prompt to save changes if there are unsaved changes is a common example and I want to be able to detect that and handle it. Here is the specific problem: I'm testing a pretty...

Webdriver: find element by html tag which contains an html tag which belongs to a certain class

java,selenium,webdriver
to clarify a really messy title: There is a piece of page code that looks like this (I have simplified the actual code): <div class="CLASS1"> <p>... <p> <strong> <i CLASS2 "></i> THE DATA I WANT </strong> </p> <p>... <p>... </div> I am using Selenium Webdriver with Java and I've been...

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

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

I need some help in identifying button using CSS or Xpath from the HTML

python,css,xpath,selenium-webdriver,webdriver
I am automating our website using Webdriver with Python. I am having trouble identifying and clicking the Administration button. I was trying to switch to the iFrame and select the button. It wasn't finding the button. I have spoken to the Dev and the developer says it's not in an...

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

Selenium Webdriver python storeTextPresent

python,selenium,webdriver
How can I perform a storeTextPresent in Selenium WebDriver with python? In Selenium IDE the following code works: storeTextPresent regexp:[Tt]ext test gotolf storedVars['test'] == true exists Source: <tr> <td>storeTextPresent</td> <td>regexp:[Tt]ext</td> <td>test</td> </tr> <tr> <td>gotoIf</td> <td>storedVars['test'] == true</td> <td>exists</td> </tr> I want to do the same thing with Selenium WebDriver. Best...

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

Watir-Webdriver EOFError and Errno::ECONNREFUSED

firefox,selenium,webdriver,watir-webdriver,headless
While running a DelayedJobs queue that uses Watir-Webdriver (with Headless and Firefox) to get some data off the web a few times per hour, I am encountering random EOFError and ECONNREFUSED errors. It's a reasonably simple script that goes to a site, logs in, enters data in a form and...

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

How do I load the ChromeDriver binary from the classpath?

java,webdriver,classpath,selenium-chromedriver
A number of sources make reference to loading the ChromeDriver binary from the classpath, but I haven't worked out how to do it if the binary is not in the classpath root. To specify the path for the binary it seems that you have to set a system property "webdriver.chrome.driver"....

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

creating a testing script using selenium web driver for a web page but not able to verify after login

java,selenium,webdriver
I am writing my first test cript using java for selenium webdriver. The code goes like this import static org.testng.AssertJUnit.assertTrue; import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.htmlunit.HtmlUnitDriver; public class ligintest { public static void main(String[] args) { // TODO Auto-generated method...

How do I control new tabs with Selenium WebDriver after they are opened?

java,selenium,selenium-webdriver,webdriver
I need to run different task on multiple firefox tabs. Each tab will load a different url at the start of the application. The a process one will run on a tab, go to next, run next tab, go to next tab etc. My issue is when I return to...

Fire ng-change of Angular page using Selenium

angularjs,selenium,selenium-webdriver,webdriver
I have two inputs as follows: 1st <input type="text" class="form-control ng-isolate-scope ng-valid-date ng-animate ng-dirty ng-valid ng-valid-required" name="measurementDate" id= "measurementDate" placeholder="MM/DD" datepicker-popup="MM/dd" min="01/01/2014" max="12/31/2016" datepicker-options="{&quot;showWeeks&quot;:false,&quot;yearRange&quot;:3}" ng-model="acawiz.data.standardPeriodStart" ng-change="acawiz.setStandardStabilityPeriodStart()" is-open="acawiz.measurementPickerIsOpen" style=""> 2nd...

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

Need to retrieve xpath or css from WebElement Object at run time

java,selenium,selenium-webdriver,automation,webdriver
What are the possible ways to retrieve xpath or css (any logic) from WebElement object? For example I have created WebElement by following way: WebElement obj=driver.findElement(By.cssSelector(".hello")); Now I want to get back a By object from this WebElement Object or if I am able to retrieve xpath or css then...

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

Passing Webdriver As An Instance

java,selenium,webdriver
What I'm trying to do with this is to allow one section of the app to allow the user to run a few tests with webdriver. Then, without closing that window, making changes to the web app and then kicking off a separate method to perform other actions. What I've...

How do i run more than 1 Test Case in Python Webdriver. Only 1 of my test case class runs

python,selenium,selenium-webdriver,webdriver
In my automation page object model script I have created 2 TestCases so far with some test cases, methods. class LoginPage_TestCase(unittest.TestCase): class AdministrationPage_TestCase(unittest.TestCase): LoginPage has a test for testing a valid user login AdministrationPage has 1 method so far add_Project (user can add a project after having logged in) In...

selenium-java-2.43.0 does not work with firefox 36

java,firefox,selenium,selenium-webdriver,webdriver
I had installed "selenium-java-2.43.0" and all my testfiles executed ok using firefox 33 but when firefox updated to firefox 36 the web browser could not load the page. Do I have to update to selenium-java-2.4x.0?

TypeError: unbound method when i am returning a page object from my log in method

python,selenium,selenium-webdriver,webdriver
I am reorganizing my webdriver, python framework which I have recently started. Scenario: I log into our website from the LoginPage Class calling the userLogin_valid method (this logs in a valid user) I have changed this method to return Main Dashboard Page object because when user logs in the main...

I am trying to work out absolute Xpath an Add button that is a child element

python,css,xpath,selenium-webdriver,webdriver
I am having trouble identifying the Add button on our website which I am in the process of automating. Python, Webdriver. I have tried few Xpath suggestions it does not work. I have spoken to the dev and she says the button is outside of the iFrame and there are...

WebDriver Selenium browse file Java

java,eclipse,junit,webdriver
Can't browse file using webdriver. driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); driver.findElement(By.id("1434461513889_57_7_input.file")).sendKeys("C:\\PDF_V1_COL88810_6L_Frangipani_TL_Fr_P1211089.pdf"); Have this error: NoSuchElementException: Unnable to locate element: {"method":"id","selector":"BatchUploadPlugin_57_fileupload"} HTML code...

Not able to locate input element using Selenium WebDriver

c#,selenium,selenium-webdriver,webdriver
I am new to Selenium. In a specific scenario I am not able to catch an input element. below is the code: <ul class = "form1"> <li class="firstName"> <input placeholdervalue="First name" tabindex="1" placeholder="First name" class="text" placeholdevalue="First name" data-input-rule="name" data-value-rule="required" maxlength="20" type="text"> </li> </ul> I want to locate input element. I...

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

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

I am trying to work out Xpath or CSS for an Add button

python,css,xpath,selenium-webdriver,webdriver
I am having trouble identifying the Add button on our website which I am in the process of automating. Python, Webdriver. Selenium IDE gives the following Xpath: adminAdd_button = driver.find_element_by_xpath("//button[@type='button'])[33]") adminAdd_button.click() I get the following error when i try this Xpath in my python, webdriver code. selenium.common.exceptions.InvalidSelectorException: Message: The xpath...

First Selenium using Maven and Java,

java,selenium,webdriver
I have written my even first code using Selenium Web driver, Maven and Java. Can someone give expert opinion if I am in the right direct and if this particular code can be improved. public class myFirstTest { @Test public void startWebDriver(){ WebDriver driver = new FirefoxDriver(); driver.navigate().to("http://www.ft.com/home/uk"); Assert.assertTrue("title should...

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