New answers tagged

0

Actually will use Xpath, when we don't have a suitable or unique id/name attribute for the element which we wish to locate. We can take xpath of an element in Three ways. Absolute XPath (Not preferable, starts from main parent tag of element) Relative XPath (Starts from parent tag of the current element,which you wish to locate.) Same Level Xpath ...


0

@Saurav - When you are able to select your document perfectly, anyways control/focus will be automatically shifted to your main browser window. Isn't it really? Still if you wanted to handle from code, I will suggest to go through How to handle browser pop-up. Core concept will remain same. If you want to use sendKeys() to upload a file using selenium web ...


0

Do you or your team have permission to access database ? If yes, you can prepare pre-condition data directly in database Write some store procedures to setup pre-condition step. Run these setup on Test account. Create a job to clean everything on Test account each day.


1

Jenkins is doing exactly what it should be doing: the point of executing test cases along with a build is to fail the build as soon as any changes break any of the regression test cases. If this is not what you want to happen, you need to change your Jenkins setup: If the tests fail because there is a real problem - fix the application. The application ...


5

My answer borrows from NarendraC's answers. @Test (priority=1) public void CreateNew() throws Exception { Process p = Runtime.getRuntime().exec("exeFiles\\CreateNew.exe"); p.waitFor(); } @Test (priority=2, dependsOnMethods={"CreateNew"}) public void OpenaFile() throws Exception { Runtime.getRuntime().exec("exeFiles\\OpenaFile....


0

Solution 1 - I will suggest to degrade your ff browser version. You are unable to connect to 127.0.0.1 might because both version has not support for each other. Upgrade or degrade version for Selenium or FF will resolve issue. Note - Prefer to degrade FF version, I got success with same. Solution 2 - Try running this before you start your Selenium ...


0

Even why cant you try "dependsOnMethods", This will be useful in that sense. Check out below example for use: @Test (priority=2, dependsOnMethods={"CreateNew"})


0

I think a better (though more complicated) way of doing it, instead of thread sleep, is to use a messaging queue and publish/subscribe model.


1

There IS a way to click on a certain coordinates (X, Y), but you need to locate an element as the reference first. Can you please try this approach? Actions builder = new Actions(driver); builder.moveToElement(referenceElement, X, Y).click().build().perform(); where X and Y are the offsets from the reference element.


-2

You can use //button[@class='add-widget ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only'or @title='Add widget']


1

You have made one mistake here: driver.findElement(By.xpath("//button[contains(@class,'add-widget ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-state-hover')]/span[contains(@class,'ui-button-icon-primary')]")).click(); There is no class goes by the name "add-widget ui-button ui-widget ui-state-default ui-corner-all ui-button-...


1

First once clear the input text fields and send the input values.Create a reference object for better use. webElement objPh=driver.findElement(By.name("phone")); webElement objSSN=driver.findElement(By.name("ssn")); objPh.clear(); //To clear the phone text field objPh.sendkeys("(222)222-2222"); // To send the input values in phone text field objSSN....


4

Simpler solution is try a waitFor() on your process, this waits until the process exits. @Test (priority=1) public void CreateNew() throws Exception { Process process = Runtime.getRuntime().exec("exeFiles\\CreateNew.exe"); process.waitFor(); Integer result = process.exitValue(); AssertEquals(0, result) } Now you can add an exit ...


0

Use following code that may help : driver.switchTo().frame(driver.findElement(By.id("frmmenusuperior"))); Thread.sleep(3000); WebElement menu=driver.findElement(By.xpath("//ul//li[@title='Register']//a")); Actions actions = new Actions(driver); actions.moveToElement(menu).perform(); WebElement submenu = driver.findElement(By.xpath("//ul/...


0

If sendkeys methods are not working then use following two ways to input text: 1. Before sendkeys use click method to click inside textfield i.e driver.findElement(By.name("phone")).click(); driver.findElement(By.name("phone")).sendKeys("(222)222-2222"); driver.findElement(By.id("ssn")).click(); driver.findElement(By.id("ssn")).sendKeys("555-55-5555"); ...


0

I'd say that you should use an enum. Gender is enumerable, so it makes sense to model it as that (indeed, anything which is a radio button strikes me as enumerable). Something like the below would encapsulate it neatly. I've used a switch because they work well with enums, but I guess you could use if/else. private static final By OPTIONS_GENDER_MALE = By....


0

Selenium determines an element is visible or not by the following criteria (use a DOM inspector to determine what css applies to your element, make sure you look at computed style): visibility != hidden display != none (is also checked against every parent element) opacity != 0 (this is not checked for clicking an element) height and width are both > 0 ...


0

As Peter mentioned your problem could be that you are using implicit waits instead of explicit waits. Here is another resource on the difference between the two. The crazy thing about Chrome, Firefox and IE is that all three run at different speeds. I've found Chrome to be the fastest, Firefox to be the middle ground and IE to be the slowest. That means I ...


0

Try this in Java, List<WebElement> elements=driver.findElements(By.xpath(".//*[starts-with(@id,'ct100_cPH_rptrDisplayRecords')]")); int numberOfElements=elements.size(); for(int i=0;i<numberOfElements;i++){ elements=driver.findElements(By.xpath(".//*[starts-with(@id,'ct100_cPH_rptrDisplayRecords')]")); elements.get(i).click(); //click ...


0

Possibly this link can help. Just some first steps though, using http://restcountries.eu. Reference: http://learnseleniumtesting.com/rest-api-testing-using-csharp/


0

You have not provided HTML code, but please feel free to use the following example as a reference: Say your HTML codes looks like: <table class="transaction-table" <ul <li value="152" /li> <li value="153" /li> <li value="154" /li> /ul> /table> where each element li represent each transaction ...


0

If you don't checkbox, try to get a selector for a checkbox from the body of the table, if multiple found the first one is used. One way of clicking on the edit for the checkbox that is checked is to get an Xpath selector based on the checked value. Please provide html code for what the image is describing for a more particular answer. <input id="...


0

@santhosh - I have already shared answer, here. It might resolve your problem. Hope it helps!


0

You're not focused in the right window. With this case you want to use: driver.SwitchTo().Window(driver.WindowHandles.Last()); Last() will switch to the most recently opened window which should be the one you just clicked.


0

Selenium doesn't provide any functionality to deal with Excel documents, however assuming you're using Java you can read and write Excel files using Apache POI library Reference code: Workbook wb = new HSSFWorkbook(); CreationHelper createHelper = wb.getCreationHelper(); Sheet sheet = wb.createSheet("Sheet1"); Row row = sheet.createRow(0); Cell cell = ...


1

A Platform independent way to create folder would be something like:- File rootDir = File.listRoots()[0]; File dir = new File(new File(new File(new File(rootDir, "Users"), "xyz"), "screencapture"), "new folder you want to create"); if (!dir.exists()){ dir.mkdirs(); }


0

If you have a C# Selenium Framework (built on MSTest or even NUnit) then you may have issues running Parallel tests. Especially if you want to fire these tests off in BrowserStack or SauceLabs. Java framework at least has TestNG to help with this but for dotnet it is a lot trickier...


1

There might be slight differences in behavior of different browsers (because they are written by different teams). Selenium tests can be flaky - fail, and later pass with no changes. As with many Open Source tools, documentation might less than perfect. Reference docs is there but examples might be scattered over blogs. This is rapidly improving recently. ...


1

@Lyndon, Completely agree. @Rajesh, Its not the area of Selenium. Its open source framework for web-automation and now they have extension of it for mobile platform called as Appium. Not possible using Selenium!


0

@Richardson, I would like to mention few where I faced issues or challenges with Selenium: Image or text overlapping issue No facility to deal with Captcha Doesn’t support any non web based (Like Win 32, Java Applet, Java Swing, .Net Client Server etc) applications When you compare selenium with QTP, Silk Test, Test Partner and RFT, there are many ...


0

You can use any of the below mentioned way to select that particular element. driver.FindElement(By.Xpath("//input[@title='Name Required Field']")).sendKeys("Newprojecttest"); OR driver.FindElement(By.Xpath("//input[starts-with(@Id,'FileLeafRef')]")).sendKeys("Newprojecttest"); Hope it helps!


0

I recommend using a CSS selector, yours would look something like: var element = driver.FindElement(By.CssSelector("input.ms-long")); element.SendKeys("Newprojecttest"); Hope this helps


0

You can try different selectors based on existing value of attributes that do not change or to use a selector based on a fixed part of the attribute. Here are some css selectors that you can try: input[id*='FileLeafRef'] input[id*='onetidIOFile'] input[title*='Name'] input[title='Name Required Field']


0

in some times you will face this type of problems to find the elements,at that time you can try different methods,mostly it will work for driver.findelement(By.name("xxxx")).click(); By.name will work most of the times,same i have faced and resolved with these name locator. Please accept this answer in case it is resolved your problem.


1

What I am thinking is as following: driver = webdriver.Firefox() e = driver.find_element_by_xpath("//someXpath") location = e.location size = e.size print(location) print(size) If I can get the size and location for an element, given an element is symmetrical, I can calculate its boarders as well. As long as one element's boarder does not cross into ...


1

That was what I had previously believed also (because I've done dev) until my current position whereas the director is my source for this who actually sees the numbers. Although, maybe its more specialialist thing. You generally don't become wealthy as anyone's employee.


4

Test automation is not high-end coding. You will not become wealthy doing either test automation or unit testing. Typically, unit-testing is not a separate job title. Experience with unit testing is more likely to lead to a career as a developer than Selenium automation. You are likely to make more money as a developer than as a tester.


0

Issue has solved I was looking in different folder which had different pom.xml, :p :)


0

You can also use css selectors like these: select[name*='DateOfBirth'] select[onchange*='DateOfBirth'] #content-holder select[name*='DateOfBirth'] #content-holder select[onchange*='DateOfBirth']


0

Agree to you[user246] and addition to that, Page Object classes, For each page we will create a separate class with constructor A constructor that returns a new instance of the specific page object Constructor takes, task of initializing all the web elements for particular page


2

I think you are trying to detect if elements are overlapping. You will need some way in the clientside to tell you if two elements are colliding. I would try jQuery collision for this or some custom JavaScript code. Add or inject jQuery and jQuery collision to the web-app under test Use the Selenium javascriptExecutor to fire a collision detection on two ...


2

If this overlapped texts belongs to single element, lets say label, or text field. You can locate that element and use "webElement.Text.Contains("the text you want to validate");" method to validate your expected text. And if the overlapped texts belongs to different element, you can simply locate that specific element and validate the text of that element. ...


-1

can we use this appender..... testname testrun ${testname}.log ${testname}.%i.log 1 100 10MB %d{ISO8601} %-5level %C{1} [%M:%L] [%thread] - %msg%n


1

I seeing that this is C#, so not sure if this would work. But you can use a new variable, whose type is WebElement, something like this WebElement ele = webdriver.FindElement(By.Xpath('Xpath_that_you_have')); Please note that you need to replace Xpath_that_you_have with the actual xpath that you have mentioned. then, use this ele element and find the ...


0

This Answer is based on Selenium Webdriver: There are following reason to fail the script: When you open up page , Submit All button is not loaded in page Submit All button is not in visible area (or half visible). Note : selenium is only work with fully visible component You may have multiple button or element on page with //span[text()='Submit All'] ...


0

I would suggest getting down to HTTP protocol level and focus on simulating browser rather than driving a real browser. Pros: Reliable record and replay (at least more reliable, with minimal correlation) Increased execution speed Functional tests can be converted to load tests in few seconds (even more increased execution speed) Multiple browsers can be ...


0

@Bunny - Give a try to below solution : element_select_frame.sendKeys(""); textBox.sendKeys("Bunny, Pls Enter your text in text box"); Hope it will help ! Come up if you have queries.


0

@ihossain, I have faced this issue and below solution works for me : element.submit();


0

@joser - My Solutions will be: If page is not loaded 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)....


0

For verifying Look and feel of the application , What Did was integrating an image comparison library to my selenium scripts .Selenium has the capability of taking screenshots , what we need to do is developing a solution which could compare the screen shots taken in current run against previously taken set of screens . In my case I had lot of screen shots ...



Top 50 recent answers are included