Selenium webdriver How to click on required button with same class using selenium

In a specific screen, there are three buttons(Advaced Mode, Next, Cancel) in one page with same input class under one div style.Using selenium webdriver, i have automate these. Using Selenium Webdriver, i have to automate these. if i make use of xpath i can click on required button. But i dont want to depend on xpath, so i'm looking for altenate solution like css related identifications. Advanced Mode: input class="submit" type="button" value="Advanced Mode" onclick="goAdvance()" Next: input

Selenium webdriver DataDriven testing with TestNG using Apache POI in Selenium WebDriver

I am new to TestNG framework. Please guide how to parameterise the test cases using Apache POI(Excel). I have a code to read from second row from Excel. public class spreadData { private transient Collection data = null; public spreadData(final InputStream excelInputStream) throws IOException { this.data = loadFromSpreadsheet(excelInputStream); } public Collection getData() { return data; } private Collection loadFromSpreadsheet(final InputStream excelFile) throws IOExcepti

Selenium webdriver How to create TestSuite class in TestNG without xml file

I Want to run Sanity.java and regression.java together so I've created TestSuite.java in junit and it is working. Now I want create the same using TestNG, plz help me.. Below is my junit framework code: package com.abc.def; import org.junit.runner.RunWith; import org.junit.runners.Suite; import com.auto.tests.abc1; import com.auto.tests.abc2; import com.auto.tests.abc3; import com.auto.tests.abc4; @RunWith(Suite.class) @Suite.SuiteClasses({abc1.class, abc2.class,abc3.class,abc4.class}) pub

Selenium webdriver getting the column cell values of a web table using selenium

I want to retrieve the text of each cell in a column in a web table. I get the column index from a method and pass it as a parameter to this method: public List<String> getColumnValues(int colIndex) { WebElement colElement; List<String> colValues = new ArrayList<String>(); List<WebElement> rows = getRows(); System.out.println("Rows count: " + rows.size()); Iterator<WebElement> i = rows.iterator(); while (i.hasNext

Selenium webdriver how can i compare two Lists

There are two Lists, i want to compare these lists having same values or not how can i do this please suggest List<WebElement> Gender=wd.findElements(By.xpath(".//*@id='MyMember_GenderId']")); int genderval=Gender.size(); System.out.println(genderval); for(WebElement G : Gender ) { System.out.println("Gender is :"+G.getText()); } List<WebElement> Mstatus=wd.findElements(By.xpath(".//*[@id='MyMember_MaritalStatusId']")); int statusval=Mstatus.size(); System.out.println(statusval

Selenium webdriver selenium webdriver golang sendkeys with control

I am trying to open new tab with selenium webdriver for golang using control+t kyes following example for another languages. But cannot figure out how to send control. My attempts with "ctrl t", "control t", "Control t" failed. package main import ( "github.com/fedesog/webdriver" ) func main() { chromeDriver := webdriver.NewChromeDriver("/Users/maks/Downloads/chromedriver") err := chromeDriver.Start() if err != nil { panic(err) } desired := webdriver.Capabili

Selenium webdriver passing variables inside find element method in Java?

how to pass variables inside find element method in Selenium or Appium using Java? Is it possible to pass the 'GROUP' (value = users) in the below example as a parameter to the method and how to do it? I have a list like users, field, etc and I want pass users or field as a parameter and find the element passed on what I'm passing. eg: public static boolean select(group){ dr.findElementByAndroidUIAutomator("UiSelector().text(group)").click(); }

Selenium webdriver If we set Firefox profile for parent window, will that be carry forwarded to child window when we use "driver.switchTo().window(child window Id)

I have a doubt in case of parent and child window handling. If we set Firefox profile for parent window, will that be carry forwarded to child window when we use "driver.switchTo().window(child window Id) " or we need to explicitly set the profile explicitly once again. One more doubt is ..... Will the profile be reassigned to parent when we do driver.switchTo().window(Parent window Id) ? Thanks, Raje

Selenium webdriver How to create Gmail account using Selenium, I am having trouble with month and country drop downs

I want to select Gmail month and country drop downs using select class, but it shows the error like Element should have been "select" but was "div" I handled with actions class but not with select class. I tried with x path, id and class but I didn't get. I'm new to selenium. Here is my code. d.get("https://accounts.google.com/SignUp?continue=https%3A%2F%2Faccounts.google.com%2FManageAccount"); d.manage().window().maximize(); Select s=new Select(d.findElement(By.id("BirthMonth"

Selenium webdriver Selenium webdriver script is not able to click any element after successfully login

I tried all possible element locators but after successfully login the code is unalbe to click the element I want it to click. I get following error: ... class charSequence { String str1="abcdef@gmail.com"; String str2= "abcdfghhh"; CharSequence cs1 = "int1"; CharSequence cs2 = "int2"; //boolean retval; public charSequence(String str){} } public class QueuedRefund { public static void main(String[] args) { String[] temp1 = new String[1]; Stri

Selenium webdriver Protractor moves on to next test without waiting

I'm using protractor and when I run my tests on browserstack I receive the following error StaleElementReferenceError: stale element reference: element is not attached to the page document or depending on what I do in the beforeAll Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector ... Here is the code snippet causing the error: describe('...', () => { it('...', () => { expect(element.all(by.css

Selenium webdriver Click on image as Button?

I have tried click this pop up (X)image, which is link. I have done this with all possible selectors including Xpath, class & cssSelectors but no result. Please suggest is this a special case of image/button. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); Thread.sleep(35000); driver.findElement(By.xpath(".//*[@id='share_preview_modal']/div/div[1]/button")).click(); I also tried same with wait, relative & absolute xpath, .sendKeys(Keys.ENTER); - failure <div

Selenium webdriver Unable to perform Action class operations on GeckoDriver

Unable to perform right click operation in below link. Have tried almost all the cases to automate it. https://the-internet.herokuapp.com/context_menu I am using Selenium 3.3 and geckodrivers latest version. Actions act = new Actions(driver); act.moveToElement(element).click(); act.contextClick(element).build().perform(); act.sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).bu‌​ild().perform();

Selenium webdriver Trying to get TRACE level logging from Geckodriver

I'm trying to get trace logging information out of the gecko driver, in order to debug some issues we're having with moving to newer versions of Python, Robot Framework, Selenium, Firefox. See in the DEBUG robot output below, I'm setting the capabilities to include log level arguments as part of moz:firefoxOptions. When the capabilities are printed out for Open Browser, the moz:firefoxOptions value has been replaced with the profile info, so I never get tracing set. 20190219 13:07:22.461 - IN

Selenium webdriver How to handle gmail compose button? I'm trying to find the element by xpath, cssSelector... etc. but not working

I just want to click on compose button after login to the gmail account. When I am trying to find the element by xpath(Static, dynamic and customized way), cssSelector. It will not able to find the element I don't know why? Can any one suggest me how to face this challenge? //driver.findElement(By.xpath("//*[@id=\":f3\"]/div/div")).click(); //driver.findElement(By.xpath("/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div")).click(); //driver.findElement(By.x

Selenium webdriver QAF Perfecto - Not able to consume test data from XML

When trying to consume data from XML in the project in Quantum Perfecto, I am getting Lexing error. I have attached the scenario with this and the error. Evern the same error is seen in quantum starter kit project too. @GettingToKnowYou Feature: Verify the Borrower can Navigate through Getting To Know You Pages @GKY @Test Scenario Outline: Verify Borrower complete Getting To Know You Page Given User already Signed with "<emailaddress>" and "<password>" Examples: {'k

Selenium webdriver Protractor - Unable to launch firefox with capabilities and multiCapabilities in config file

I am trying to launch the firefox browser with this code, my code for chrome is working fine. But with firefox getting trouble I have launched chrome with both way capabilities and multicapabilities and it working fine but when I try to do same with firefox. IT is throwing error. capabilities: { 'browserName' : 'firefox', //'safari.options': { technologyPreview: true } 'moz:firefoxOptions': { args: ['--safe-mode'], }, //'acceptSslCerts' : tr

Selenium webdriver Is it possible to use 2 WDS for 2 different users roles in 1 JMeter Thread group?

There are 2 users roles in Application. When running 2 users roles sequentially in 1 browser (login1 - actions1 - logout1, login2 - actions2 - logout2), the set of problems with users identity /pages visibility and fails occurs. Is it possible to use 1 dedicated browser window for each user role in 1 JMeter Thread group? Or what could be solution to split 2 users for 2 separate browsers and manage them as 1 group acting sequentially, role1 actions first and then role2 actions?

Selenium webdriver Unable to type ampersand "&" in Selenium-2

I want to type the ampersand "&" key in the text-box with selenium web-driver. But selenium-2 looses its focus from type-box while typing the ampersand. My command is, self.type("&", :update => true) I know that in selenium, keys are sent in UTF_8 format and I have tried to send the equivalent of ampersand but the behavior is still same (as expected). I know XML or HTML supports ampersand with some special escape characters. I want to know is there a way to replace the ampersand with so

Selenium webdriver Invoking popup window

I am trying to invoke pop up windows,but always getting error like "Element not found in the cache - perhaps the page has changed since it was looked up" Anybody can help? My html code is this one <td class="tdLabel"><label for="productName" class="label">Product Name<span class="required">*</span>:</label> </td> <td> <input type="text" name="accountVO.productName" value="" readonly="readonly" id="productName" style="height:14px;"/>

Selenium webdriver Selenium WebDriver cannot locate element within an iframe, and throws NoSuchElementException

I realise there are several queries on here for this same problem but none of them provide a solution to my particular problem. I am running a web driver test that tries to fill out a form for a mail website to find postcodes based on address details. I keep getting this error when trying to locate the first text box: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"#ctl00_BodyContent_txtBuildingNumber"} I have used xpath and the id

Selenium webdriver How to do basic authentication using Selenium Webdriver and PhantomJS?

I'm having trouble authenticating using Selenium Server 2.33.0, Selenium Webdriver JS binding 2.34.0 (npm package "selenium-webdriver") and PhantomJS 1.9.1 on Mac 10.6.8. I've also tried the other JS bindings "webdriverjs" and "wd" with the similar results so I don't think it's a problem with this binding. I setup the Webdriver using this: return new Webdriver.Builder(). usingServer('http://localhost:4444/wd/hub'). withCapabilities({ "browserName": "phantomjs", "phanto

Selenium webdriver Element not found in Selenium test when div Element reloads after page load

I am creating an automation framework where I need to get the value from the element and match it with the value I have collected beforehand. Now , the issue is , div value is updated after page is loaded so even after adding implicit wait/fluent wait/Thread.sleep the code doesn't work. But when I debug the code , the code works properly without doing any kind of changes.I am not sure what must be done regarding it. Since I am a new user I cant add the image in this question but the initial "t

Selenium webdriver Changing Download Location in Google Chrome using Selenium Webdriver

I have tried the following code: ChromeOptions profile=new ChromeOptions(); profile.addArguments("disable-popup-blocking", "true"); profile.addArguments("download.default_directory","D:\\WORKSPACE\\SeConnect\\Downloads\\"); profile.addArguments("download.directory_upgrade", "true"); profile.addArguments("download.prompt_for_download", "false"); driver = new ChromeDriver(profile); But it is not setting the path. It is using default path.

Selenium webdriver How to get the Text inside HTML <p> (paragraph) element

Below is the HTML snippet for a radio button. I want to get the 'Select from list' using selenium Webdriver.Unable to fetch using getText() <p> <input type="radio" checked="checked" value="1" name="selectedItem"> Select By Audit ID </p> <p> <input type="radio" value="2" name="selectedItem"> Select from list of My Open Audits </p> <p> <input type="radio" value="3" name="selectedItem"> Select from list of All Open Audits </p>

Selenium webdriver How to get page object by name or number relative to another page object in Selenium WebDriver

Is it any way how to return page object by name or number like this: homePage.get(widget.class, "Name").get(Input.class, 1).setValue("yahoo"); I create classes of my UI elements (widget, Input) with get methods which can return objects of any class Class of Widget public class widget{ WebDriver driver; By searchResult = By.xpath("//div[@id='ires']//a[contains(text(), '')]"); public widget (WebDriver driver) { this.driver = driver; } public void click() {

Selenium webdriver wraping of webelement in my program for selenium webdriver

After creating few wrappers for selenium webdriver framework. i'm trying to create/invoke the driver object for webelement. its giving the NPE .kindly let me out here.. code tried.. @Override public WebElement findElementbyId(By el) { element = driver.findElement(By.id("el")); return element; } i want to access webelement like element.findById("email"); kindly share my the snippet on this.

Selenium webdriver Programatic SauceLabs Tunnel control

Does anyone have any experience controlling SauceLabs SauceConnect tunnels programmatically for Selenium WebDriver testing? Specifically from within Java code. The examples in the SauceLabs documentation assume that a tunnel is created manually before a test is executed or there is a permanent tunnel somewhere used by all tests. The tunnels would need to be unique for each test, and support having multiple tunnels/tests running simultaneously on the same box. Anyone using the project should

Selenium webdriver IE 11 Selenium WebDriver Input Text is slow even with 32-bit IEDriverServer.exe

I've had a problem regarding the slow pacing of the keyword Input Text. I've seen solutions online but so far it seems nothing seems to fit my needs. I've got a 32-bit IEDriverServer.exe and it is still slow. One thing I noticed is that when I remove the registry item TabProcGrowth with the value 0 in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main, The speed will go back to normal which is fast but it won't detect any other window (opened through buttons) which is most of our tests.

Selenium webdriver Getting error while running selenium grid

When using my code: DesiredCapabilities caps = new DesiredCapabilities(); DesiredCapabilities.chrome(); caps.setCapability(CapabilityType.BROWSER_NAME, "Firefox"); caps.setPlatform(Platform.WINDOWS); caps.setCapability(FirefoxDriver.MARIONETTE, value); WebDriver driver = new RemoteWebDriver(new URL("localhost:4444/wd/hub"), caps); driver.get("google.com"); WebElement element = driver.findElement(By.name("q")); element.sendKeys("BrowserStack"); element.submit(); System.out.println(dr

Selenium webdriver isEnable() is not working in selenium webdriver for find the button is enabled or disabled?

i am trying the bellow code,but always return true value. if(updatebuton_status=="true"){ Thread.sleep(timmer*3); //click on the update button //ieDriver.findElement(By.xpath("html/body/div[1]/div/div/div/div[3]/div/div[1]/div/div/table/tbody/tr/td/table/tbody/tr/td[3]/div/div/div[2]/div[3]/div/div/div/div[2]/div/div[2]/div[2]/div/div/div[3]/div[2]/div/div/div/div[3]/div/div/div/div/div/div[2]/div[1]/div/div/div/di

Selenium webdriver Why does this script not work for Internet Explorer?

My compiled AutoIt script automates OS windows like "upload file selection window". For Google Chrome it works. But using InternetExplorerDriver it does not send the file path to the OS window. Below is the code. I am running testng.xml to trigger the browser. import io.github.bonigarcia.wdm.ChromeDriverManager; import io.github.bonigarcia.wdm.InternetExplorerDriverManager; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.ie.InternetExplo

Selenium webdriver How to define actions in page object modeling

I am newbee to selenium. I was trying to access menu->sub-menu in PageObject Modeling. My requirement is to click on Menu item and sub-menu item which appears dynamically. I was going through StackOverflow and in one of the resolutions it was mentioned to write Actions as Actions actions = new Actions(driver); actions.moveToElement(currentOpenings).build().perform(); WebDriverWait wait = new WebDriverWait(driver,10); wait.until(ExpectedConditions.elementToBeClickable(ausJobsSub

Selenium webdriver Can we write a generic method that takes element as parameter and returns the result. (e.g.method returning the result of isDisplayed() function)?

I am writing selenium code (Java) for a form page that consists of 5 different elements (Textfield, radio, checkbox, list, dropdown). I have to check the visibility of each elements (e.g, txtfield.isDisplayed()). I am following page object model and I have a page class that defines all elements and methods to work with the elements. At present, I have written 5 different methods for each element to return visibility status. That works fine. However, I want to understand if it is possible to h

Selenium webdriver Handling Alerts in HtmlUnit

How the alerts in HtmlUnit will be handled? For Supposeenter image description here It is not required to click "OK" in htmlUnit. But in selenium, it will throw UnhandledAlertException. How it is different in HtmlUnit from Selenium.

Selenium webdriver Starting Edge Chromium in InPrivate mode / headless mode did not work for selenium

I'm trying to start edge chromium in private mode during my selenium / java test.I also want to start it in headless mode. I tried some options, but none of them are working. As per Microsoft site, (https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium?tabs=c-sharp) i passed UseChromium property as true. But still i am unable to get the headless and private browsing to work. Please provide your ideas. Edge chromium version: Version 81.0.416.77 (Official build) (64-bit) msedgedriv

  1    2   3   4   5   6  ... 下一页 最后一页 共 14 页