By Jeremy Payne
In the below article I will show the process of installing a plugin for Visual Studio which will allow the automatic escaping of double quotes when pasting into a string literal.
When copying XPath from the Perfecto Object Spy you are copying XPath which surrounds string values with double quotes (").
And when pasting the XPath into C# code you must manually change the double quotes to either single quotes or escape the double quotes.
//*[@text='Login'] or //*[@text=\"Login\"]
We can solve this using a Visual Studio plugin called: SmartPaster2013
You can read about this plugin here.
To install the plugin from within the IDE first go to Tools->Extensions and Updates
Next click Online->In the search box type SmartPaster2013->In the screen show below the green check box you will see a download button. Click download and follow the prompts.
Finally to use the feature, right click where you wish to paste and select Paste As String Literal
The result of your copy from object spy and paste will look like the below, with the double quotes automatically escaped: