PermanentLinkMapStore.TryToMapped and PermanentLinkUtility.GetContentReference not working after EPiServer 9 Upgrade

Upgrading EPiServer 8 to 9 might result in this warning:

Warning CS0618 ‘PermanentLinkMapStore.TryToMapped(string, out string)’ is obsolete: ‘This method only supports classic/mapped url’s which are no longer used since 8.0 – use PermanentLinkUtility.GetGuid(url) to get the unique ID from an URL’

How to solve warning:

You can try:

EPiServer.Web.Routing.UrlResolver.Current.GetPermanent();

or

EPiServer.Web.Routing.UrlResolver.Current.TryToPermanent();

to get a permanent link

 

See more info here: PermanentLinkMapStore.TryToMapped and PermanentLinkUtility.GetContentReference not working after EPiServer 9 Upgrade

node.js – Node Sass could not find a binding for your current environment – Stack Overflow

Error in Visual Studio 2017 in output window from task manager:

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 5.x
Found bindings for the following environments:
– Windows 64-bit with Node.js 8.x

Solution

For VS 2015

  • Go to: Tools > Options > Projects and Solutions > External Web Tools

For VS 2017(.3)

  • Tools > Options > Projects and Solutions > Web Package Management > External Web Tools (per @nothrow)

  • Reorder so that $(PATH) is above $(DevEnvDir)\Extensions\Microsoft\Web Tools\External

enter image description here

 

See stackoverflow here:

Source: node.js – Node Sass could not find a binding for your current environment – Stack Overflow

Session problems when setting up Azure Web App Service

I had a problem with a web app service on Azure, the session state was not functioning properly.

2 instances where running for the website and the Session affinity cookie was set to Off, that was the problem, ARR makes sure that the user stays on the correct webserver for the duration of the session.

I had to turn it ON, see link below for where to find it.

Disable Session affinity cookie (ARR cookie) for Azure web apps

‘fatal: unable to access ‘\/.config/git/config’: Invalid argument’ when running VS 2017 and opening a GIT based solution

I got this message ‘fatal: unable to access ‘\/.config/git/config’: Invalid argument’ when opening a GIT based solution in VS 2017.
Solution was to add an environment variable “HOME” with value “c:\” (c: or where your project folder resides).

Solution info here:

Source: I get ‘fatal: unable to access ‘\/.config/git/config’: Invalid argument’ when running VS 2017 as a user on a different domain from local windows user – Developer Community

How to solve Selenium error Element is not clickable at point (x, y) Other element would receive the click

The error message looks like this:

System.InvalidOperationException : unknown error: Element <... (html) ...> is not clickable at point (x, y). Other element would receive the click: <...(html)...>

Stack trace
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Click()

Solution:
The clickable element is not ready, it might not be visible or clickable.
Sometimes the element is covered by another html element. (hide the covering element first).

Steps:
1. Wait for element to be visible
2. Wait for element to be clickable
3. Click with javascript

If this still this doesn’t work insert an implicit wait between step 1 and 2. (Thread.Sleep() in c#)

C# driver code to solve problems:
Wait for element to be visible and clickable (ElementToBeClickable = element is visible AND enabled.)

        public IWebElement WaitUntilElementIsClickable(By findElementsBy)
        {
            var wait = new WebDriverWait(driver, timeoutForElementShouldBeVisibleInSeconds);

            try
            {
                var element = wait.Until(ExpectedConditions.ElementToBeClickable(findElementsBy));
                return element;
            }
            catch (Exception exception)
            {
                string message = exception.Message + " at findElementsBy " + findElementsBy.ToString();
                Exception customException = new Exception(message, exception);
                throw customException;
            }
        }        public IWebElement WaitUntilElementIsClickable(By findElementsBy)
        {
            var wait = new WebDriverWait(driver, timeoutForElementShouldBeVisibleInSeconds);

            try
            {
                var element = wait.Until(ExpectedConditions.ElementToBeClickable(findElementsBy));
                return element;
            }
            catch (Exception exception)
            {
                string message = exception.Message + " at findElementsBy " + findElementsBy.ToString();
                Exception customException = new Exception(message, exception);
                throw customException;
            }
        }

Click with javascript:

        public void ClickOnElement(string cssElementSelector)
        {
            string js = $"document.querySelector(\"{cssElementSelector}\").click()";
            ExecuteJavascript(js);
        }
		
		        public string ExecuteJavascript(string script)
        {
            return ExecuteJavascript<string>(script);
        }

        /// <summary>
        /// Executes JavaScript in the context of the currently selected frame or window.
        /// </summary>
        /// <typeparam name="T">The converted return type</typeparam>
        /// <param name="script">The JavaScript code to execute.</param>
        /// <param name="args">The arguments to the script.</param>
        /// <returns></returns>
        public T ExecuteJavascript<T>(string script, object[] args = null)
        {
            IJavaScriptExecutor javaScriptExecutor = uiTests.Driver as IJavaScriptExecutor;
            object result = null;

            var wait = new WebDriverWait(uiTests.Driver, timeout: TimeSpan.FromMinutes(3));
            wait.Until(ExpectedConditions.ElementIsVisible(By.TagName("body")));

            result = javaScriptExecutor.ExecuteScript(script, args);
            T typedResult = (T) result;
            return typedResult;
        }

 

How to Increase build agent execution time? (VSTS)

When running long running tests (perhaps UI tests with Selenium)
I got this error:

The job running on agent xAgentNamex has exceeded the maximum execution time of 01:00:00.

The default timeout for VSTS Agent is 60 minutes.
The solution was to increase Build job timeout in minutes, under settings of build definition in the VSTS dashboard.

Solution found here:
Source: tfsbuild – How to Increase build vnext build agent execution time? – Stack Overflow

Problem with remote Selenium IE driver “Unable to find element with css selector”

Running my Selenium tests locally against IE11 works fine, but when calling remote Selenium server running the same browser and Selenium drivers setup I get this:

System.Exception : Timed out after 10 seconds, could not find visible element 'By.CssSelector: body'
 ----> OpenQA.Selenium.WebDriverTimeoutException : Timed out after 10 seconds
 ----> OpenQA.Selenium.NoSuchElementException : Unable to find element with css selector == body

The problem is connected to the fact that the IEDriverServer.exe runs the server IE11 version. In my case this is a Windows Server 2016 which has a higher security restriction.

For me the solution was to disable the Internet Explorer Enhanced Security Configuration. Follow this guide for the Windows Server 2016 version.

Disable Internet Explorer Enhanced Security Configuration in Windows Server 2016

The same error could also be caused by javascript not enabled for the driver:

options.AddAdditionalCapability("javascriptEnabled", "true");

or need driver to switch to the correct frame/window

webDriver.switchTo().defaultContent()

More info here:
https://github.com/SeleniumHQ/selenium/issues/3611

.net – NUnit 3.2.1 + TeamCity: Could not load file or assembly ‘nunit.framework’ – Stack Overflow

21 down vote I had the same problem with TeamCity 10.0.1 (build 42078) and NUnit 3.4.1. And it turned out to be completely my fault. I’m posting it here as someone else can stumble into the same problem and this can save them some time. It turned out that the problem was in the “Run tests from: ” setting in my build configuration. I had **\*.Test.dll. That was accidentally picking up dlls for \obj\**\ directories (where there is no nunit.framework.dll present). Once I changed the setting to **\bin\%Bui

Source: .net – NUnit 3.2.1 + TeamCity: Could not load file or assembly ‘nunit.framework’ – Stack Overflow

Error when starting EPiServer 7.5+ site on server environments – Could not load file or assembly ‘JetBrains.Annotations, Version=

[FileNotFoundException: Could not load file or assembly ‘JetBrains.Annotations, Version=8.0.5.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325’ or one of its dependencies. The system cannot find the file specified.] EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +1508 EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +84 EPiServer.Global..ctor() +91 ASP.global_asax..ctor() +9

The workaround is to include the JetBrains.Annotations.dll in the bin folder of the application. 

Use Nuget package manager console to install the exact version missing. Select the Web project as the default project (to install into that project) in Package Manager Console and enter this command:

install-package JetBrains.Annotations -version 9.1.1.0

The above is for version 9.1.1.0, for more info regarding downloading old versions of nuget packages, see this link:
http://stackoverflow.com/questions/5628689/download-old-version-of-package-with-nuget

Read more here: Error when starting ASP.NET website – Language Agents / .NET Agent – New Relic Community Forum