New answers tagged

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.


0

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


0

Selenium is the wrong tool for measuring page load times. Selenium can't actually block until the page finishes loading, so it has to poll the browser. Your load time precision is constrained by the poll interval. The most accurate tools for measuring page load times are browser extensions like YSlow, Firebug, and the Chrome DevTools.


2

Instead of voting for closing I am going to use your question as an example to how not to ask questions. How are we supposed to know what do you need ? we don't know what the product is, what are the company's future plans for the product or testing, what is the budget and how much time do you have or can spend automating stuff, what's your priorities, how ...


4

One way is to use a singleton class like this: public class FirefoxDriverProvider { private static FirefoxDriver instance = null; public static FirefoxDriver getInstance() { if (instance == null) { instance = ... initialize FirefoxDriver here ...; } return instance; } } In your TestNG classes, you can do ...


1

Using priority to drive order of execution is perfectly fine, but question is why do you want to execute test cases in certain order? As a general rule test case should be atomic and should not be dependent on another test cases. In such case do you worry about order of execution. I rather don't pay much attention to order of execution unless its an explicit ...


0

why don't you check normal http response. That will also work for a normal http page. Here is the code sample that you can use. @Test public void sampleTest(){ //test method //your code boolean abletoOpenPDF=linkResponse(driver.getCurrentUrl()); } public static boolean linkResponse(String url){ try { ...


0

If the element not being found is an expected failure in the event of a bug. One thing you can do is throw an assertion error which imitates the natural way to fail a test. try { driver.findElment(by.name("textbox")).click(); } catch(ElementNotFoundException e) { throw new AssertionError("A clear description of the failure", e); } Passing in your ...


0

I would assume that to run test cases in parallel, you need to have multiple instances of the same test - which is not possible if classes are static. In Agile development, when deciding which approach to use to solve a problem, good idea is try spike solution - in your example it would be before committing yourself to architecture, try one simple test ...


0

I reccomend after SendKeys to fire an event fireEvent(locator, blur). From documentation: fireEvent(locator, eventName) Arguments: locator - an element locator eventName - the event name, e.g. "focus" or "blur" Explicitly simulate an event, to trigger the **corresponding "onevent" handler**. SendKeys does not do the same thing as your keyboard ...


1

As I understand you want execution to stop if error occurs, in that case you don't want to inclose your code in try and catch block. Remove try and catch block and add @AfterMethod in your testng class. Once your program errors out it would move move to AfterMethod block or after successful completion of your test. @AfterMethod public void cleanup(){ ...


0

Automating the screenshots can be done by webdriver directly - see example. But I assume that by saying "I record my actions via Selenium" you mean Selenium IDE - that is different from webdriver. Selenium webdriver requires some (not much, especially in Python) programming skills. Python would be more future-proof than Perl, and also easier to learn - ...


0

You can locate this element by using either of these methods: xpath: //div[@id='info-usuario']//div[@class='clearfix']//p[1] css selector: div#info-usuario > div.clearfix > p Locating an element using css selector is considered more reliable than xpath in any of the automated testing services as it works with multiple browsers.


0

Your scenario is really long and include many things. Let break down it to smaller parts, example Search product Go to site Search with keyword Verify search result Compare product Go to product detail page Click "Compare this Product" button Verify something comparison page: price, quantity, ... it depends your purpose Checkout Go to product ...


0

From your picture, I guess that you just enter the text and still not Save, so it is not updated and you cannot get it. --> Try to save it, then open it again, I think you can get the text easily. If the text already Save, try to inspect element and search "Administrator" text to see where it is.


0

My product use AngularJS and Select2 jquery for the dropdown and it appears same as your case, hope my exeperience can help you There are 2 ways to do Execute JS to enable the dropdown, then select item as normal driver.ExecuteScript($('elementLocator').attr('Style','display:block')) Click on div first to enable something (as @scorpion mentioned) , ...


0

Given the main title one option is to not use Jenkins and use CircleCI, another CI server. I used to Jenkins myself and switched recently to CircleCI (via a job move). In Jenkins we had several issues (can't remember details) that prevented us from running in Parallel but in CircleCI it is easier and is working well. We use 4 slots so our 24 minute suite ...


0

Instead of automating after the code is done, try to automate during development together with the developers. This way you can solve any issues you run into together. Make it part of the definition of done of a feature. So instead of planning ahead, try to fix issues as you run into them and get a common understanding what is expected from each other. Else ...


0

I feel your pain - I have to deal with the same problem. Protractor (as suggested by Tam Minh) is one way to do that, but for the price: you have to write tests in JavaScript, which is for many (including me) too steep price to pay, because rest of our development and testing is in Python. We use locating elements by other methods: name, class, tag, text, ...


3

Agreeing on good element and attribute identifiers is essential with web applications. Identifying elements is done by developers, designers and automation programmers. In a traditional waterfall environment with most of the requirements and specifications placed up front you can agree that, for example all elements that will be used, checked, clicked on ...


-1

Instead using Selenium, you can write it by C#, Java or another language. Below is the link for C#. C# sample


0

AngularJS will generate some HTML, you should take a look on Protractor instead asking for "no dynamic ids"


-1

"At a guess, your page has JavaScript code to search dynamically on any keypress, and SendKeys does not trigger the event that triggers the search. You're going to need to find the JavaScript code that populates your dropdown menu, then work out how to force Selenium to trigger that specific event." – Kate Paulk 17 hours ago This worked, i got event to ...


0

Instead if using WebDriver use the EventFiringWebDriver and sendkeys will work without any issue and fire the text change event as well.


0

I think you need to inspect to know which event fire when typing on the textbox, try to fire that event using JS or JQuery, then force Selenium execute script.


0

It's hard to check if the button is clickable (working) or not without clicking on it. For your case, so you can use IsDisplayed and IsEnabled to compare status before and after the changes happen.


0

Assert.IsFalse(button.Enabled);


0

Autoupdate happens AFTER you finish typing, right? I think you need to end the string with TAB ("\t") to leave the input field, so all related events can fire.


1

Yes absolutely right. Because all those bookmarks, addons, passwords etc.. are saved In your regular browser's profile folder so when you launch browser manually, It will use existing profile settings & It will show you all those stuffs. But when you run your software web application's tests In selenium webdriver, It Is opening new browser ...


0

Use following code: WebElement firstName = driver.findElement(By.xpath("//input[@name='firstName']")); String value = firstName.getText(); System.out.println(value);


0

Basically the problem seems like, the attribute "value" is not updating automatically, so after entering the text into textbox click somewhere else on the page and then use the method getAttribute("value") hope it will works......


0

Possibly answered here. Not sure if this should be flagged as a duplicate or not.


0

It would help to check for other javascript attributes if getText is not working. How about if you try: el.getAttribute("innerHTML"); If that does not work, double check the element you are getting the text from. Are there any children elements for the input element?


0

When are you trying to get a value? before entering or after entering it in the text field? WebElement fName=driver.findElement(By.name("firstName")); fName.sendKeys("Admin"); System.out.println(fName.getText()); Above code should return text entered.


0

1: Select Cdropdown = new Select(driver.findElement(By.xpath("//select[@id='ClientId']"))); Cdropdown.selectByVisibleText("centralpen-ak-01"); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); Select Edropdown = new Select(driver.findElement(By.xpath("//select[@id='EnvironmentId']"))); Edropdown.selectByIndex(0); ...


1

adding Thread.sleep(3000) is not a good way to handle synchronization, rather use implicit wait. driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); Implicit wait allows your browser to wait until element is visible or until time set by you, whichever is earlier.


10

Do you think that time is the problem here? If so try to increase the time you are providing in Thread.sleep(); and see it that works out for you. If its not the time, then did you try to find out what the problem is? Are you getting any error?


1

Selenium IDE & firebug can work on any versions (mostly above v-31.0) of Mozilla FF. both are Firefox plugins so they don't affect on any versions. If you are asking about Selenium WebDriver & ff versions then it may differs from version to version & Selenium java jars. but my perspective IDE & firebug can work on any versions of ff.


0

In a webpage, there is a "Top" window, which can be considered as a default frame (not conceptually) and there can be zero or more iframes. While executing the automation test script, the driver always points to the default frame which is "Top". If you want the driver to find the element which is inside an iframe, you need to first locate the iframe and ...


0

I just upgraded my selenium to 2.53 and upgraded to Firefox latest 46.0.1 and everything started working fine with relative xpath.


0

Everything has a context. Will you join or start an automation project? Follow the language of this project. Do you want a fast learning curve on the basics of programming and automation? Take a look in Python; do a Codeacademy-like course and play with each entry on the Learn X in Y Minutes site - try run and change things to see what happens. After that, ...


1

The silence is deafening :-) I have no personal experience with NightWatch, but I do have experience with the quirky nature of JavaScript, and because of that experience prefer Python, especially for big projects. Why you never ever reprogram working code from scratch - with history of failures cause by reprogramming from scratch. So if your company is ...


0

Python is widely considered best language for beginners, much simpler than Java or C#. Once you understand programming in Python, it will be easier to learn other languages (and you will understand why Python is easier). But before all this, you should learn how to use Google. This exact question is asked on this exact forum every week. Try this


0

Robotframework-seleniumLibrary is a good choice, if you want to get involved with less coding and more test automation. Python or Java may be a good choice to start with, if you want to focus on test automation.


0

It's simple, just you have to use Select method in WebDriver. WebElement countrydropdown=driver.findElement(By.id("country_id")); Select country=new Select(countrydropdown); country.selectByVisibleText("India (+91)");


0

Solution 1 : You are putting extra brackets for this. So remove it: //input[starts-with(@type,'text')][contains(@name,'login')] Solution 2 : You have to use conditions for xpath. //input[starts-with(@type,'text') and contains(@name,'login')] Please let me know If any query.



Top 50 recent answers are included