w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can protractor test a login that is not angular based
After placing the issue on github I received the answer I was looking for. This can be found HERE! Protractor requires that Angular be present on the page and the way around this is to use the driver directly. Following the link above should stear anyone stuck on the same issue in the right direction. Kudos to JulieMR and the others who helped out with this issue.

Categories : C#

Error "Unable parse file browser.yml" when running a test with Magento automation test framework
I've resolved this by upgrading the Symfony Yaml package to the latest version: pear channel-discover pear.symfony-project.com pear install symfony/YAML Seems that the "---" syntax is supported on v. 1.0.6 (the latest stable at this moment).

Categories : Magento

How do I tell Mocha to only run a certain test in the browser (and not in node.js)?
if(window && window.document){ runBrowserOnlyTests(); } //? Oops. Forgot to check for existence of window first. Sorry I didn't catch that. You could just check for 'document' globally but explicit seems best in this case as document or window could easily be some other var in Node. If somebody defined an object named window in Node with a document property, well, that's just ignorant. Although I suppose you could then check constructor names if you were worried about that but this strikes me as sufficient, especially since I assume node modules each have their own global objects or their wouldn't be much point to the require method. (somebody correct me if I'm wrong)

Categories : Javascript

test studio - new browser on fail
From Telerik's help forums: [Setup] if (Manager.Current.Browsers.Count > 1) { Helpers.KillBrowserProcesses(_browserType); } if (ActiveBrowser == null || !Process.GetProcessesByName(_processName).Any()) { var retries = 0; bool browserOpened; do { try { browserOpened = true; Manager.LaunchNewBrowser(_browserType, true, ProcessWindowStyle.Maximized); retries = 0; } catch { retries++; browserOpened = false; Console.WriteLine("Restarting the browser. Retry {0} of {1}", retries, Configuration.Instance.BrowserOpeningRetries); if (Manager.Browsers.Count <= 0) continue; Helpers.KillBrowserProcesses(_browserType); //foreach

Categories : C#

How to performance test code in a browser
If you want to perform just some statistics you could use Speed Tracer. "Speed Tracer is a tool to help you identify and fix performance problems in your web applications." But if you want to do some more concrete tests (stress, performance, etc.), I would propose you to use Selenium. There you could use waitForElementPresent to wait for the needed elements, produced by your Ajax calls, in a dynamic period. waitForElementPresent(locator) If your elements were already loaded, and you just fill in the data, you could always force to do add a new element at the end of the body. $.ajax({ type: "POST", data: {data: somedata }, url: someurl, success: function(html){ $("<div/>", { id: 'finnishedId', }).appendTo("body"); } });

Categories : Javascript

How to run a new browser instance per test with Watir?
In general, you would want to create a Before hook to open the browser before each test and a After hook to close the browser after each test (see more on hooks on the cucumber wiki) Assuming you are starting your browser in the support/env.rb, you would replace your existing code with a before and after hook: Before @browser = Watir::Browser.new end After @browser.close end

Categories : Ruby

How to test Basic Authentication in an MVC.NET application using a browser
I found this post here: SimpleMembership in MVC4 app + WebApi using basic HTTP auth I was able to refer to the test page used on this tutorial: http://kevin-junghans.blogspot.ca/2013/02/mixing-forms-authentication-basic.html to setup a simple testing page to test that basic authentication was working properly. I'm not entirely sure on the reason, but I believe that the browser doesn't automatically add an authentication header to the HttpRequest when you try sending the credentials like so: http://user1:pass1@localhost/{AppName}/Client/Authorize It must have something to do with the browser requiring a 401 response from the server first before sending the authentication header. I just couldn't figure out how to do it. If anyone knows how to configure IIS/browser properly so you can

Categories : Asp Net Mvc

After launching the specified browser with Selenium RC, The test doesn't run
The mistake I made was that my selenium test "BasicTest.html" wasn't a test suite. Since it was a single test, the -html suite didn't recognize it. It only looks for a test suite to execute. I had to put the "BasicTest.html" into a "SeleniumTestSuite.html" and referenced that instead. So the new command looked like this: java -jar selenium-server-standalone-2.35.0.jar -htmlSuite "*googlechrome" "http://www.xxxx.com" "C:UsersTunjiDesktopSeleniumTestsCoreFunctionalitySeleniumTestSuite.html" "C:UsersTunjiDesktopSeleniumTestsCoreFunctionality esults.html" -firefoxProfileTemplate "C:UsersUsernameAppDataRoamingMozillaFirefoxProfilessrebkp2.selenium" After that It ran like it was supposed to :). Hope that's clear enough. Tunji

Categories : Java

What's the correct way to close and open the browser within a Geb test?
Add in your test, for save sessions cookies. autoClearCookies = false link

Categories : Groovy

inside jspx doesn't show in browser
Try this simple .jsp page if anything works at all. Test page uses random fmt and c features. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%@ page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" import="java.util.*, java.text.* " %><% String var0 = "Foodoo0 " + System.currentTimeMillis(); pageContext.setAttribute("var1", "Foodoo1 " + System.currentTimeMillis()); pageContext.setAttribute("var2", "Foodoo2 " + System.currentTimeMillis()); double distance = 1234.567; pageContext.setAttribute("distance", distance); %><!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test page</title> <m

Categories : Jsp

Run Webdriver Junit browser specific test cases
You can easily do this with JUnit with your own runner. In fact, there is a similar working code in Selenium WebDriver test - it's just backwards. The Selenium guys wanted to skip some tests for particular browsers, so they introduced a custom @Ignore annotation. Take a look at JUnit4TestBase, SeleniumTestRunner and finally TestIgnorance. You can use their idea to make the opposite and only run the tests with the desired drivers. However, I think you'll need to write it yourself as I am not aware of any good solution out there.

Categories : Java

Invoke Javascript Test Click in Web Browser control
[EDITED] What I said below was incorrect. Your syntax is correct, webBrowser2.Document.InvokeScript("TestClick") should do the same job as webBrowser2.InvokeScript("TestClick"). I'll try your code and get back here. I think the correct syntax should be this: webBrowser2.Document.InvokeScript("TestClick()"); Note () after TestClick. Or you could rather do: webBrowser2.InvokeScript("TestClick"); [EDITED] There's something wrong with the HTML originally loaded into the WB, maybe you should include it with your question. The following is just a copy of your code (besides this.webBrowser2.DocumentText) and it does work, TestClick gets invoked. private void Form1_Load(object sender, EventArgs e) { this.webBrowser2.DocumentText = "<body><div id=flls><

Categories : C#

How to Initialize a C# Selenium webdriver test to pass in different browser types?
Do something like this: WebDriver _webDriver = null; if (Browser == "Firefox") _webDriver = _firefoxDriver; else if (URL == "Chrome") _webDriver = new ChromeDriver(); else if (URL == "IE") _webDriver = new InternetExplorerDriver();

Categories : C#

How to use same browser window for automated test using selenium-webdriver (ruby)?
The Before hook is run before each scenario. This is why a new browser is opened each time. Do the following instead (in the env.rb): require "selenium-webdriver" driver = Selenium::WebDriver.for :ie accept_next_alert = true driver.manage.timeouts.implicit_wait = 30 driver.manage.timeouts.script_timeout = 30 verification_errors = [] Before do @driver = driver end at_exit do driver.close end In this case, a browser will be opened at the start (before any tests). Then each test will grab that browser and continue using it. Note: While it is usually okay to re-use the browser across tests. You should be careful about tests that need to be run in a specific order (ie become dependent). Dependent tests can be hard to debug and maintain.

Categories : Ruby

Mock expectation error... Don't understand why this test fails (all works fine in browser)
Your controller doesn't call update_profile on any instance of User. It calls User#update. Try this: User. any_instance. should_receive(:update). with(identity_attributes: { "last_name" => "Bidon", "first_name" => "Bidon", "dob" => "1970-07-15", "id" => user.identity.id}) Or this if the code above doesn't work: User.any_instance.should_receive(:update)

Categories : Misc

button_to form submittal working in browser but failing rspec/capybara test with routing error
You want a regular submit tag. If using a form helper block: <%= f.submit "RSVP Now" %> Or use the standalone tag helper: <%= submit_tag "RSVP Now" %> Read the documentation on how button_to works. It is mainly used as links that should POST, such as actions that change data in some way. It is not for use with normal forms.

Categories : Ruby On Rails

Nunit loads all test Test data for all the test before the test gets executed
I think that's by design. NUnit is designed to clean up the environment before any test, to generate same conditions for any test independent their execution order. If Test A would change the XDocument, Test B would be run with that changes. That might led to indeterminate test results. If Test B expects changes made from Test A, then your tests are not fully isolated, that's a bad practice. If you wan't to change that behaviour, implement a lazy field and load the test data only on first access. You can increase performance if you know that you are not changing data in any of your tests, but pay attention. private static Lazy<IEnumerable> testData = new Lazy<IEnumerable>(GetExample); private static IEnumerable GetExample() { var doc = XDocument.Load("Example.xml");

Categories : Xml

Grails Spock integration test redirectedUrl different between localhost test-app and build server test-app
I've also just experienced this same issue, and it seems that it comes down to the test framework extracting the controller name from the the name of the testing class. The convention is that the test class is named <controller name>ControllerSpec In the above case, the test class should be named PriceTierControllerSpec so that the test framework will successfully resolve the controller to PriceTeir. Naming the class according to these guidelines seems to fix this problem. Further reference can be found here: https://jira.grails.org/browse/GRAILS-10962

Categories : Grails

VS2012: Clear the test results in Test Explorer when re-running a test that previously failed
You cant do that. Instead you can filter which test are shown to you, if that suits your needs. You can find more information about test here: http://msdn.microsoft.com/en-us/library/hh270865.aspx

Categories : Unit Testing

Can you run two test cases simultaneously in a Test Suite in Microsoft Test Manager 2010?
Yes, you can with modified TestSettings file. http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx

Categories : Testing

How to test single test modules in intellij in maven project having test dependency?
Got my answer there : http://youtrack.jetbrains.com/issue/IDEA-112978 That's because a run configuration is created by template. And that template has default setting to pick classes across module dependencies. For me in 132.46 the following helps: 1. Open Run Configuration dialog, Defaults section. 2. Find respective template. I tried JUnit. 3. "Test kind" combo, select All in package. 4. Set "In single module". 5. Apply to save the template. After that delete created configurations and repeat "Run All tests". It picks only classes from current module for me. The possible improvement in IDEA is to modify these defaults specially for Maven-based projects. Rather specific change...

Categories : Maven

How can i automate my test cases using test Microsoft Test Manager?
What you're looking for are called coded UI tests. You start by creating an action recording of your manual test and then creating a coded UI test from that action recording. Do a google search for "coded UI" and you'll find lots of information.

Categories : Misc

Can Protractor and Karma be used together?
Not recommended by the current maintainer of Protractor: https://github.com/angular/protractor/issues/9#issuecomment-19927049 Protractor and Karma should not be used together; instead they provide separate systems for running tests. Protractor and Karma cover different aspects of testing - Karma is intended mostly for unit tests, while Protractor should be used for end to end testing. Protractor is built on top of WebDriverJS, which uses a Selenium/WebDriver server to provision browsers and drive test execution. Examples of pure WebDriverJS can be found here: http://code.google.com/p/selenium/wiki/WebDriverJs And https://github.com/angular/protractor/issues/9#issuecomment-19931154 Georgios - I think it makes sense to keep Protractor and Karma separate - for end to

Categories : Testing

Is protractor Angular's new scenario runner?
In the AngularJS 1.2 and Beyond meetup last night they talked about Protractor and said that they are migrating all of their end to end tests to Protractor. It sounded like this is in the early stages but is the direction they are going. The slides are at: https://docs.google.com/presentation/d/1WHCcp3G3HxoE7b_ut_ERKJF4zQK_P4qFlESjE2E9AUQ/edit and I assume the video will be available in a couple of days. Here's the link to the meetup: http://www.meetup.com/AngularJS-MTV/events/120927882/ btw, there was a ton of really interesting info in the meetup -- well worth the watch.

Categories : Angularjs

protractor expect currenturl fails
After search for the answer to this question I figured it out myself The current url does not fail, I was not waiting for the promise to return to angular. The ammended code below shows where I had gone wrong var protractor = require('protractor'); require('protractor/jasminewd'); describe('Tests', function() { var ptor; describe('Test 1', function() { var ptor = protractor.getInstance(); ptor.get('#/current_page'); it('change page and current url', function() { ptor.findElement(protractor.By.className('.button').click().then(function() { ptor.waitForAngular(); expect(ptor.currentUrl()).toContain('#/new_page'); }); }); }, 30000); }); This then waits for angular to route to the new page and upda

Categories : Angularjs

protractor-js setting form action attibutes
Julie Ralph, the lead developer on protractor says its not (natively) possible here: https://github.com/angular/protractor/issues/82 juliemr commented on Sep 12, 2013 A user wouldn't set an attribute, so it's not a feature of webdriver. Can you find a way of running your test manually just using your page? It seems that you might have to use angular and $http.post() instead of just relying on the 's action attribute. Personally, this stinks a little. I have tests timing out because sendKeys is so slow on long text files. I'll keep you updated if I find a good work-around. Maybe there needs to be a 'pasteTextBlock' instead of 'sendKeys' ... by Julie's rationale a user might copy and paste rather than key in...

Categories : Angularjs

A way of clicking on hidden elements in protractor end to end tests
ok so after a long and painful search trying to find an answer to this question I finally came across the answer trying to answer a different question. Most of the documentation I found explain that we must use Actions in the form of a WebElement and then cast that to Javascript and pass it a script element in the form of an array with the click action. Well the same kinds goes here but with a few modifications. describe('', function() { var ptor = protractor.getInstance(); var driver = ptor.driver; it('', function() { var hiddenElement = driver.findElement(protractor.By.yourchosenlocator('')); driver.executeScript("arguments[0].click()", hiddenElement).then(function() { expect(whatever).toMatch(whatever); }); }, 30000); }); as you

Categories : Angularjs

Restrict browser refresh, f5, browser back like banking sites through javascript/jquery
(1) No. There no possible cross-browser way to control browser functionality with javascript/jquery. (2) Banking sites do not restrict or control the browser functionality. They only ask users to desist. At most they attempt to detect some actions and then show errors. But, they don't try to control the browser. (3) This is a bad idea.

Categories : Javascript

Browser requests file, server downloads pdf, browser displays pdf in iframe
Probably what you meant was simply: var uri = '/viewer/loaddrawing/'; document.getElementById('iframetitle').src = uri + '?key=' + value; There is no JSON involved, so the iframe will get a PDF directly. However, notice that the client must have a PDF-viewer plugin, otherwise the browser will ask for a download prompt.

Categories : Javascript

BlackBerry 10 browser submits form using browser submit button when using preventDefault
I have worked around this by adding action="javascript:void(0);" to you form (see updated fiddle http://jsfiddle.net/e4AHZ/11/). I do not know if this is good enough but action="javascript:void(0);" is in fact part of a solution given to a similar question. <form method="post" action="javascript:void(0);"> <input type="text" name="field1" value="some msg" /> <input type="text" name="field2" value="some msg" /> <input type="submit" /> </form>

Categories : Javascript

Image looks terrible when viewed on a mobile browser, but perfectly fine on a web browser
You'll have to use a responsive layout to resize the image according to the screen size. Example of responsive layout rule: @media screen and (max-device-width: 480px) { .column { float: none; } } You can always search "responsive design" at any web search engine to get great references.

Categories : HTML

How to open links in default browser inside InApp Browser on PhoneGap
I have been using this as a workaround (opening an inappbrowser instance): // Image zoom $('#container').on('tap', '#content.cmscontent img', function() { var browser = window.open((navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '') + encodeURI($(this).attr('src')), '_blank', 'location=no,toolbar=yes,enableViewportScale=yes,transitionstyle=crossdissolve'); }); See I added (navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '') as a prefix before the url. Now it detects when you're app is on Android and adds the local URL in front of it.

Categories : Android

Problems while previewing image before upload on mobile browser, works fine on desktop browser
Modified another code snippet for it to work properly on browser. The code snippet, I modified is mentioned at the link below. Preview an image before it is uploaded Below is the code snippet which work properly on both desktop browser as well as mobile browser. <!DOCTYPE html> <html> <head> <title>File API- FileReader as Data URL</title> </head> <body> <input type='file' id="imgInp" /> <img id="myImage" src="#" alt="your image" /> </body> <script> function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { document.getElementById('myImage').src=e.target.result; } reader.readAsDataURL(inpu

Categories : Javascript

How to force to open a web page in external browser even if Popup Browser is enabled in Samsung Galaxy Note II
I don't understand your problem clearly but may this help you: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse((String) i.getExtras().get("url"))); startActivity(browserIntent); where "url" is the URL to which you want to go in your browser. And i is an INTENT that holds the "url" from another activity. Can this help you?

Categories : Android

This browser is not supported by Shopify While Authenticating Using Web Browser Control In Windows
Your question does not describe at all what you are trying to do and what problem you are trying to solve in doing so, so my only suggestion is: Don't use a Web Browser control, but use an HTTP client like HttpClient or HttpWebRequest and access their API. There's even have a .NET library for that.

Categories : C#

Asp.Net: Retaining the old browser session after closing and reopening browser instance
You cannot reclaim the session-id as such, but you can certainly restore some of the predictable part of the session state. If you are using forms authentication, then just read the forms-auth cookie in global.asax session start and re-populate the session objects. You can control the expiration of forms-authentication cookie manually by creating a persistent cookie by using: FormsAuthentication.SetAuthCookie(userName, true) Alternatively, you can fine-tune the expiration by manually changing the cookie: Dim authCookie As HttpCookie = FormsAuthentication.GetAuthCookie(userName) Dim authTicket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(authCookie.Value) Dim newAuthTicket As New FormsAuthenticationTicket(authTicket.Version, authTicket.Name, authTicket.IssueDate, expireDa

Categories : Asp Net

Mobile Browser Compatibility: Site dont pinch in iOS browser
Try adding user-scalable=yes to your viewport meta tag <meta name="viewport" id="view" content="width=device-width minimum-scale=1, maximum-scale=1" /> to give you <meta name="viewport" id="view" content="width=device-width minimum-scale=1, maximum-scale=1", , user-scalable=no /> And I would move your Meta tage up near the top with the rest.

Categories : HTML

Need some plugin to use in selenium for browser compatable( for cross browser UI testing )
Selenium is a browser automation tool. It can only drive the browser by interacting with an HTML page loaded in the browser. There are currently no plugins (and as far as I'm aware nobody has any plans to make any) that you can add to Selenium to enable it to automate the OS level GUI.

Categories : Testing

Child browser is not showing content of pdf in browser in android phonegap
The pdf will not get render as android webview does not support rendering pdf and the childbrowser uses android webview. Instead you can use some third party sdks for rendering in Android. Most of them require license(like quoppa,pdfViewer). I have not seen any opensource but you can look into the follwing link https://github.com/jblough/Android-Pdf-Viewer-Library For ios you can use pspdfkit.They are providing a cordova plugin also. go through the following link. https://github.com/PSPDFKit/PSPDFKit-Cordova

Categories : Android

How to change and blink the title of the browser when the user goes to other tab or minimizes the browser?
For blinking the title: var title = document.title; var intv = window.setInterval(function () { document.title = document.title === '' ? title : ''; }, 500); // call this to stop the blinking function stopBlink() { window.clearInterval(intv); document.title = title; } As for doing it on tab switch or minimize, maybe running the code on window.onblur would work but I'm guessing it can't be done.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.