selenium-webdriver

How to increase code execution time limit in Selenium webdriver using C#

ぃ、小莉子 提交于 2020-03-06 09:21:28
问题 Website is taking time to load when requesting a data from it. If website loads within 60 seconds, then everything is ok. Beyond that time, it throws me to error section. Actually, this code is executing for 60 sections only. this.driver.FindElement(By.CssSelector("#btnLogin")).Click(); How to set the driver to wait for this code to be executed completely? Thank you 回答1: You can increase page load wait time beyond the 60 seconds(default), say example 70 seconds as given below. driver.Manage()

How to fail the test if Element is found and pass the test if element is not found?

一笑奈何 提交于 2020-03-05 09:47:06
问题 I have to develop a unit test which fails if element is present and passes the test if element is not present. To be detailed, I have a simple form like name, email, address etc. When I click on the save button, error message is displayed if required fields are empty. If error message is displayed then I have to fail the test and if not displayed then pass the test. Is there any solution? try { //Click on save button IWebElement save_profile = driver.FindElement(By.XPath("//div[@class='form

Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)

给你一囗甜甜゛ 提交于 2020-03-05 06:45:45
问题 I develop the selenium code that: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; import java.util.List; public class TestDemoQA { public static void main(String[] args) throws InterruptedException{ System.setProperty("webdriver.edge.driver", "C:\

Apache POI recording only 1 row in the spreadsheet

*爱你&永不变心* 提交于 2020-03-05 06:06:54
问题 I am using selenium and java to scrape data on a specific site, but with the code below I can write only 1 data in the spreadsheet, it is not recording all the data in sequence as it should be. I can't structure the loop correctly. public void gravarDados() throws IOException { int i = 0; File localPlanilha = new File("tools/resultado_da_pesquisa.xlsx"); FileInputStream planilhaExistente = new FileInputStream(localPlanilha); XSSFWorkbook plan = new XSSFWorkbook(planilhaExistente); XSSFSheet

How to click on a link with trailing white-space characters on a web page?

江枫思渺然 提交于 2020-03-05 03:22:32
问题 There are links like this on a web page: Overview General Settings AR Server Settings Cache Settings Report Settings Web Service Settings Log Settings Change Password I am writing an automation script in selenium under Java eclipse and want to click on Cache Settings option. Can some one help? I know this would be simple, but i am a newbie in this world.i am able to automate previous steps til coming to this web page and now stuck in clicking Cache settings. HTML snippet: <div class=

Issue in Selenium TestNG Page Object Model framework

扶醉桌前 提交于 2020-03-05 01:29:40
问题 I am creating selenium framework using Page Object Model. Currently I have two test cases in separate classes. If, I run the testng.xml file, only the first class gets executed. Null pointer exception occurs when the second class is initiated. When I run the classes separately, both are working fine. But, when I try to run them both only the first class gets executed. Null pointer exception occurs on the second class. Base class.java package com.midcities.pages; import java.io.File; import

Issue in Selenium TestNG Page Object Model framework

安稳与你 提交于 2020-03-05 01:29:03
问题 I am creating selenium framework using Page Object Model. Currently I have two test cases in separate classes. If, I run the testng.xml file, only the first class gets executed. Null pointer exception occurs when the second class is initiated. When I run the classes separately, both are working fine. But, when I try to run them both only the first class gets executed. Null pointer exception occurs on the second class. Base class.java package com.midcities.pages; import java.io.File; import

Issue in Selenium TestNG Page Object Model framework

落爺英雄遲暮 提交于 2020-03-05 01:28:26
问题 I am creating selenium framework using Page Object Model. Currently I have two test cases in separate classes. If, I run the testng.xml file, only the first class gets executed. Null pointer exception occurs when the second class is initiated. When I run the classes separately, both are working fine. But, when I try to run them both only the first class gets executed. Null pointer exception occurs on the second class. Base class.java package com.midcities.pages; import java.io.File; import

TypeError: required field “posonlyargs” missing from arguments error running a Pytest Script on Python 3.8.1

半腔热情 提交于 2020-03-03 10:01:28
问题 I created a Simple Selenium Pytest automation script on Python 3.8.1. After running the script I see the below error: Traceback (most recent call last): . . . Error messages . . TypeError: required field "posonlyargs" missing from arguments I googled and saw that this seems to be an issue with Python 3.8.1. Any suggestions on how to avoid this error? I could always go back to the previous Python version (3.8.0), but I'm keeping that as the last option. 回答1: This error message... TypeError:

TypeError: required field “posonlyargs” missing from arguments error running a Pytest Script on Python 3.8.1

試著忘記壹切 提交于 2020-03-03 10:01:07
问题 I created a Simple Selenium Pytest automation script on Python 3.8.1. After running the script I see the below error: Traceback (most recent call last): . . . Error messages . . TypeError: required field "posonlyargs" missing from arguments I googled and saw that this seems to be an issue with Python 3.8.1. Any suggestions on how to avoid this error? I could always go back to the previous Python version (3.8.0), but I'm keeping that as the last option. 回答1: This error message... TypeError: