selenium-webdriver

switch to new window after clicking on the hyperlink using selenium

旧时模样 提交于 2020-12-16 04:16:55
问题 Can anyone help me how to switch to new window after clicking on a hyperlink using selenium while doing automation . I have tried the following code but my test case is failing : public void openView(){ final WebElement visa=driver.findElement(By.id("pageContainer")); timeOut(10000); final List<WebElement> images=visa.findElements(By.className("nametag")); String handlewindow = driver.getWindowHandle(); for(String winHandle : driver.getWindowHandles()){ driver.switchTo().window(winHandle); }

switch to new window after clicking on the hyperlink using selenium

烂漫一生 提交于 2020-12-16 04:15:53
问题 Can anyone help me how to switch to new window after clicking on a hyperlink using selenium while doing automation . I have tried the following code but my test case is failing : public void openView(){ final WebElement visa=driver.findElement(By.id("pageContainer")); timeOut(10000); final List<WebElement> images=visa.findElements(By.className("nametag")); String handlewindow = driver.getWindowHandle(); for(String winHandle : driver.getWindowHandles()){ driver.switchTo().window(winHandle); }

switch to new window after clicking on the hyperlink using selenium

别来无恙 提交于 2020-12-16 04:15:18
问题 Can anyone help me how to switch to new window after clicking on a hyperlink using selenium while doing automation . I have tried the following code but my test case is failing : public void openView(){ final WebElement visa=driver.findElement(By.id("pageContainer")); timeOut(10000); final List<WebElement> images=visa.findElements(By.className("nametag")); String handlewindow = driver.getWindowHandle(); for(String winHandle : driver.getWindowHandles()){ driver.switchTo().window(winHandle); }

Selenium chrome failed to start

▼魔方 西西 提交于 2020-12-15 06:55:22
问题 Running the most basic selenium test I can think of. using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium.Chrome; using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; using OpenQA.Selenium.Firefox; namespace UnitTestProject1 { [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { String path = @"D:\Selenium Webdrivers\ChromeDriver\"; IWebDriver driver; driver = new ChromeDriver(path); } } } I am using, Chrome Version 52.0.2743.82

Loop through Web Elements and Click each link

£可爱£侵袭症+ 提交于 2020-12-15 06:24:23
问题 Hi my code works My goal is to loop through each element in the table and and click the element so i can go to the next page basically I want to do this 1 click element form drop down 2 //code some stuff 3 Go back 4 click next element from drop down 5 code some stuff and etc My code: List<WebElement> CCTable = driver.findElements(By.id("companyIdBarCompListGrid_rows_scrollpane")); for ( WebElement client: CCTable) { System.out.println("\n"+client.getText().substring(0, 20)+"\n"); client.click

Selenium identifies the button as clickable when it wasn't

China☆狼群 提交于 2020-12-15 05:44:12
问题 I'm having an issue where Selenium is saying a button is clickable even when it's disabled. I'm using Selenium with a website where you have to select a date first and then time slot from a dropdown list before the "Book" button is clickable and will actually do anything. Before the date and time slot are chosen, the button element is <div id="pt1:b2" class="x28o xfn p_AFDisabled p_AFTextOnly" style="width:300px;" _afrgrp="0" role="presentation"><a data-afr-fcs="false" class="xfp" aria

Get a page with Selenium but wait for unknown element value to not be empty

故事扮演 提交于 2020-12-15 05:27:19
问题 Context This is a repost of Get a page with Selenium but wait for element value to not be empty, which was Closed without any validity so far as I can tell. The linked answers in the closure reasoning both rely on knowing what the expected text value will be. In each answer, it explicitly shows the expected text hardcoded into the WebDriverWait call. Furthermore, neither of the linked answers even remotely touch upon the final part of my question: [whether the expected conditions] come before

Can we define new Object[3][] without defining number of columns?

假装没事ソ 提交于 2020-12-15 04:55:27
问题 Can someone please help me understand the following code? I'm new to java, I'm trying to learn Objects[]. This code compiles but retval does not return anything? I've done a lot of search online but can't find why is Object[3][] compiles and does not complain? What does the following code mean? (new Object[1])[0] = tt; How can "retval[0] = new Object[1];" compile if Object is two dimensional array. package Package1; import org.testng.annotations.Test; public class Test1 { @Test public void

Compilation error: Exception in thread “main” java.lang.Error: Unresolved compilation problems with findElement(By.Id()) using Selenium Webdriver

喜欢而已 提交于 2020-12-13 21:06:13
问题 I have configured Java, Eclipse and Selenium to be used for automating a web based application. But, I am facing below mentioned issues: Issue 1: Warning : Build path specifies execution environment JavaSE-14. There are no JREs installed in the workspace that are strictly compatible with this environment. Issue 2: Unable to access objects of selenium in the code. Issue 3: Getting the below mentioned compilation error: Exception in thread "main" java.lang.Error: Unresolved compilation problems

Compilation error: Exception in thread “main” java.lang.Error: Unresolved compilation problems with findElement(By.Id()) using Selenium Webdriver

早过忘川 提交于 2020-12-13 21:03:54
问题 I have configured Java, Eclipse and Selenium to be used for automating a web based application. But, I am facing below mentioned issues: Issue 1: Warning : Build path specifies execution environment JavaSE-14. There are no JREs installed in the workspace that are strictly compatible with this environment. Issue 2: Unable to access objects of selenium in the code. Issue 3: Getting the below mentioned compilation error: Exception in thread "main" java.lang.Error: Unresolved compilation problems