This is a migrated thread and some comments may be shown as answers.
Chrome doesn't work with file:/// urls
2 Answers 19 Views
This is a migrated thread and some comments may be shown as answers.
Mihael Zak
Top achievements
Rank 1
Mihael Zak asked on 13 Mar 2012, 04:27 PM
Hello.
I'm trying to write a simple test for a Chrome plugin.
I'm running Win7 x64, VS2010, with latest version of Telerik Testing Framework(2011.2).

Everything works fine when I'm trying to access a normal(http://) url, but fails when calling NavigateTo on a "file:///" url.
It just hangs on the "Preparing browser for automation..." page, and doesn't budge from there.
The same code works with Internet explorer.

Here's my test code:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ArtOfTest.WebAii.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;
 
namespace ChromeTests
{
    [TestClass]
    public class ShowForm
    {
        private Settings testSettings;
        private Manager testManager;
 
        [TestInitialize]
        public void Init()
        {
            testSettings = new Settings()
                               {
                                   Web =
                                       {
                                           Browser = BrowserExecutionType.Chrome // works fine if changed to InternetExplorer
                                       },
                                       LogLocation = @"c:\testLog.txt"
                               };
            testManager = new Manager(testSettings);
            testManager.Start();
            testManager.LaunchNewBrowser();
        }
 
        [TestCleanup]
        public void Cleanup()
        {
            testManager.Dispose();
        }
 
        [TestMethod]
        public void Local()
        {
// works fine if changed to "http://www.google.com"
            testManager.ActiveBrowser.NavigateTo("file:///D:/TFS/ChromeToolbar/ChromeTests/bin/Debug/TestForms/sample1.htm"); 
            var tdNum = testManager.ActiveBrowser.Find.ById("tdNum");
            Assert.IsNotNull(tdNum);
            Assert.AreEqual("1", tdNum.InnerText);
        }
    }
}
Thanks for any help!

2 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 13 Mar 2012, 05:54 PM
Hello Mihael

This is actually expected behavior for Chrome and Safari. There is a security limitation with those browsers that prohibits Test Studio from launching a local page stored on disk. You must locally host that web page (http://localhost:XXXXX/sample1.htm) to work around this.

Regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Mihael Zak
Top achievements
Rank 1
answered on 14 Mar 2012, 08:30 AM
I must say this is disappointing, but oh well.
Thanks alot!
Asked by
Mihael Zak
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Mihael Zak
Top achievements
Rank 1
Share this question
or