New answers tagged

0

Simple ready2use snippet > Working perfectly for me static void waitForPageLoad(WebDriver wdriver) { WebDriverWait wait = new WebDriverWait(wdriver, 60); Predicate<WebDriver> pageLoaded = new Predicate<WebDriver>() { @Override public boolean apply(WebDriver input) { return ((JavascriptExecutor) input)....


1

Yes. You can create an application to run your test scripts, when you create your test projects they are just libraries/dlls that you have created and they do work just like any other library/dll. add to references and you should be able to call specific tests and get their pass/fail value when they are finished.


0

The answer Peter Masiar gave no longer works. This answer will result in the following exception: Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in get self.execute(Command.GET, {'url': url}) ...


1

What you could do, is try to use an existing profile in the browser, so that way it would actually save the cookies somewhere. Otherwise the webdriver starts up an anonymous profile every time that doesn't save the cookies, it just throws them away when the browser is disposed of. This is mentioned in this SO Answer to Selenium Webdriver not respecting ...


0

Bamboo is an Atlassian product which offshore companies use for Continuous integration as it is a paid tool. We used it in one of our project, so we will give you idea on how it could be achieved. In order to configure Maven on Bamboo(Atlassian) you need to follow the following steps: 1. Log into your Bamboo instance as an admin and then select Add-ons. 2. ...


0

Just like you would write a manual test: Open browser Load URL with form Fill the fields no1 and no2 Check the fields are populated Click the RESET button Verify the fields are empty Now you just have to figure out how todo this with Selenium, but I am unsure if you want us to give you a full code example, because we wont :) Here is an idea: driver.get(...


0

I had put my code to implement for new webdriver code as below ,refer this page: https://github.com/becausetesting/commons/blob/master/src/main/java/com/github/becausetesting/cucumber/selenium/RemoteWebDriverEx.java : just use this code to use existing started selenium session: WebDriver driver=new RemoteWebDriverEx(true); full code as below sample: ...


0

I wonder how you even able to open the application? Because you have an empty space in side string many places. Problem #1 Change from : driver.get(" http://192.168.1.10:8080/sptest/home "); to : driver.get("http://192.168.1.10:8080/sptest/home"); Problem #2 Change from: driver.findElement(By.xpath(" .//*[@id='homeMainContainer']/div[1]/div/div/...


2

Agree with @Dale Emery. Use this code: public class WatchTV { WebDriver driver; WebDriverWait wait; int waitseconds = 60; public WatchTV(WebDriver driver){ this.driver = driver; wait = new WebDriverWait(driver, waitseconds); } By watchtvlink = By.linkText("Watch TV »"); public WebElement WatchTVLink() { ...


1

Your Setup() method runs (and initializes the driver) only in the Pg_WatchTV_Test class. Merely extending TestBase does not cause TestNG to run your setup method. It runs setup methods (annotated by @BeforeMethod and the like) only if the class has test methods. Your WatchTV class has no tests, so TestNG does not treat it as a test class. So the Setup() ...


0

It seems that there are more than element in the page source. I suggest you to use xpath with id of the element.It seems like that driver.FindElement(By.XPath("//input[@id='idofelement']")).SendKeys("Test");


0

I think in first case, after you clicked loginenter button, it should be added some wait time to reload page so selenium driver can not locate the element. So I suggest you to add some condition to wait next element. Please try below codes; WebElement myDynamicElement = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By....


0

An alternative is to use a universally unique identifier (UUID) that enables unique identification of information in distributed systems without significant central coordination (so no need to pass parameters to a Jenkins job). In this case each test would take care to create IDs itself: "MYOBJECT" + UUID.randomUUID() This could solve your problem, unless ...


0

There may be some misconfigurations in your specification. You declare useUnlimitedThreads=true but then threadCountMethods=5, and they don't seem to get along with each other: The parameter useUnlimitedThreads allows for an unlimited number of threads. Unless useUnlimitedThreads is set to "true", the parameter threadCount can be used with the optional ...


3

May be because there are many elements on the page with same xpath. check if you have more than one input type text element present on the screen. install plugin firepath on mozilla then paste your xpath over there it will highlight the elements ,if it highlights more than one element then you need to change the xpath


-1

Try SmartBear's TestComplete. It works well with web apps and desktop apps. https://smartbear.com/product/testcomplete/overview/


0

I use this function with good results: static WebElement getElementsWithAlteratingNames(String PartialName, String Tag, WebDriver driver, String Attribute) { try { List<WebElement> Elements = driver.findElements(By.tagName(Tag)); String[] ElementStrings = new String[Elements.size()]; System.out.println(Elements.size()); ...


0

No, in no uncertain terms, you cannot put Java code inside a Selenium IDE test case. If you want to write your test case in Java, you need to use Selenium Webdriver.


0

SetPageLoadTimeout is saying how long you want to wait for the page to load before the test fails. What you're after is waiting for an element to appear: WebDriverWait wait = new WebDriverWait(webDriver, timeoutInSeconds); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id<locator>)); or wait.until(ExpectedConditions....


1

When you return back to the page, page reloads and all elements become stale. For you it may look like same element (with same locator), but page is new object. So you need to fetch the elements again.


3

how many test cases can we write? Every time you ask that question, the answer will be "it depends". There is no industry standard or best practice that says, "You need 9 test cases" or "You need 1.4 times as many negative tests as positive tests." If your business contract includes conditions around test cases, you should probably honor your contract. ...


5

Absolutely you need negative cases! In fact developers will likely have focused on the positive cases so the negative cases not present can add the most value! I recommend the following breakdown: Happy, positive tests. These test what happens when the user does everything right. They also used defaults as much as possible for input values Sad, negative ...


0

For testing the application positively you have only one scenario that is successful.But testing the application negatively you have number of scenarios depending on the validations on particular fields followed in your organization. we cant say how many test scenarios for negative testing.


2

You can write test cases for both positive and negative scenarios. For example; phone number starts with a 0 phone number does Not contain "+" What most people tend to do is to devise their negative tests to be a positive scenario. This way, each test that passes is in a True state. This makes it far easier to interpret the results of your runs. The ...


0

Using BrowserMob Proxy, we capture performance data How to use BrowserMob Proxy? Download BrowserMob Proxy 2.Start BrowserMob Proxy Create a new Project and import BrowserMob Proxy with Selenium Standalone Server Jar Run the script. After running the script, you will see the proxy server is started, and respective logs are generated. As the script stops, an ...


3

If I understand your question correctly you try to run the java file and not the compiled code. Try exporting your project as an executable .jar via eclipse and run this via "java -jar FileName.jar". Regarding the second part of your question though, I´ve got no idea what you were trying to say.


0

Yes you can automate it using BrowserMob Proxy. Please use the below mentioedn link to test Network traffic using BrowserMob Proxy


0

Yes you can automate it using BrowserMob Proxy. [Please use the below mentioedn link to test Network traffic using BrowserMob Proxy https://keshavtechinfo.wordpress.com/web-automation/selenium/web-page-load-testing-using-selenium-and-browsermob-proxy/ ]1


0

A common reason for finding something in the seleniumIDE but not programmatically using webDriver is when there are multiple instances. The IDE selects the first automatically but programmaticaly you need to use [0] at the end of the element, e.g. div[0]


0

1) SelectByIndex Select select = new Select(driver.findElement(By.id("mobile-operator"))); select.selectByValue(index of the record you want to select ); 2)SelectByValue `Select select = new Select(driver.findElement(By.id("mobile-operator"))); select.selectByValue(value of the record you want to select );' 3)SelectByVisibleText Select ...


0

There are 3 ways from which you can select the value from the drop down 1) SelectByIndex Select select = new Select(driver.findElement(By.id("mobile-operator"))); select.selectByValue(index of the record you want to select ); 2) SelectByValue Select select = new Select(driver.findElement(By.id("mobile-operator"))); select.selectByValue(value of the ...


2

If you're talking about bringing the browser's window within the OS to the foreground. Selenium cannot do that. You need to introduce a library that is able to automate actions on an OS level. Selenium is restricted by javascript's same origin policy. Looks like you're using Java, so you could take a look at awt.Robot. But be aware that any solution you ...


0

I used sikuli to detect whether the browser is out of focus since it can see outside the browser window (usually on mac you can see the name of the application on top bar) and then used robot class to do a command+tab. I think you can also use java script executor to pop up an alert so that browser comes to focus before each test suite.


2

Is there any other things I am missing from my list? You mentioned "Click on all "link" elements, making sure they are valid, e.g. there is no 404." Is that good enough? Shouldn't you check that the links actually go where they are intended to go? Are you checking for consistency on all the pages? Should they all have the same look & feel? Are you ...


1

Since you have asked about tests approach in general - think about the non functional tests that are needed for your project: Desktop / mobile and different mobile compatibility - how will the site will look like in them? performance - how quickly the pages will load? and how much will take to submit the form you mentioned and continue? User experience - is ...


0

Just for anyone who stumbles across this question. The solution I have integrated into my environment is the following, and its quite easy. I have used the Build Flow plugin to create a Build Flow job. I have created 3 Maven style jobs, each job pointing to a different XML file which contain different test classes. In the Build Flow job I was able to add ...


1

I haven't found a solution, rather an alternative. I have used Jenkins and used to BuildFLow plugin to create a Build Flow job. I use this job to call 3 other jobs to run parallel. The 3 other jobs are Maven jobs which are each pointing to their own test XML files which contains the tests classes I need to be run parallel. It greatly reduced the time of ...


0

If the dom of the element changes whilst doing element.TryFindElementWait() will element be aware of the changes or will it still be looking for an element that may or may not exist in element? Selenium starts finding an element after finishing loading page, so I don't think "the dom of the element changes whilst doing element.TryFindElementWait()" ...


0

You need to find the element and than extract the text from it. Following is the code for the same. WebElement element = driver.findElement(By.xpath("//div[@class='f1']/p")); String text = element.getText();


2

When you call driver.manage().deleteAllCookies() it deletes all cookies for the current domain. So if you're on bbc.co.uk page it will not be able to remove cookies for facebook.com domain. driver.manage().deleteCookieNamed(cookieName) can delete only a cookie for a current domain. It's stems from the the way Web browsers work, WebDriver cannot do more. ...


2

The expected condition elementToBeClickable checks two things: Visibility: it's not hidden per CSS rules (display: none)and has a height and width > 0 Clickable: the element may not have a disabled attribute It's perfectly possible that those conditions are met and you're still getting that specific exception. The most likely reason is some sort of pop-...


0

I would recommend SeeTestAutomation: It enables you to record scripts, as well as play them back. You can use it free for 30 days and see if it meets your needs.


0

I think you could give Ranorex a try. Automated test cases can easily be set up with the capture and replay functionality, as you can read here: http://www.ranorex.com/how-test-automation-works.html. Additionally, it is now possible to execute tests remotely with Ranorex Remote.


0

We had faced same issues in the past. On node server before launching new node check any existing instance was running. Forcefully close the browser instances before again passing control back. Added bat file to do this functionality. It works perfect.


0

The very first thing you should do is create a matrix of your steps which will give you exact idea how many test scenarios you have to test. Based on the matrix create a CSV (or any other data provider) according to matrix and add the data. Each row of CSV will be 1 test scenario and each row will have additional column which is expected output for e.g: if ...


0

Try using XSLT reports this report will give you page loading time and in your script set wait.until logic below is the sample for script and the code for XSLT report. check index.html report you will page loading time. And set Web driver wait time to high like 5 minutes see the example. Hope this will help. //Wait for maximum 5 minutes if needed ...


0

I figured it out. Removed driver=new FirefoxDriver(); because I'm already using driver = new RemoteWebDriver(new URL(Node), capabilities); so it is not needed. That was causing a duplicate blank browser loading first.


1

What's wrong with Visual Studio Community? It's free, perfect for C# and has the Microsoft UnitTest framework integrated. And if you don't like that one, use NUnit (also free).


0

If I'm in this case, I will create a fucntion to select/unselect a checkbox then we can reuse it for all checkboxes. C# sample private void Check(IWebElement element, bool isSelect) { // get currentStatus of checkbox // if currentStatus not equal to isSelect then call click function } For a clear function, you may include it to Check() function ...



Top 50 recent answers are included