Typing Facebook Pixel in a Box

Hi all,

One important task I need to achieve is to click a box, and then paste/type the Facebook Pixel.

The pixel has 2 variables on it which I’m passing, like so:
<!-- Facebook Pixel Code --> <script>!function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '${!cmd_var2}'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=${!cmd_var2}&ev=PageView&noscript=1" /></noscript> <!-- End Facebook Pixel Code -->

However whenever the type or Xtype step arrives:

  • <!-- End Facebook Pixel Code --> is dropped (which is actually non important being a comment)
  • The closing </noscript> is dropped.

So the pixel pasted is:
<script>!function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '${!cmd_var2}'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=${!cmd_var2}&ev=PageView&noscript=1" />

I really need the pixel text pasted as is without dropping anything… as mentioned I tried both Type & XType. Any suggestions?

To avoid this issue, try copy and paste:

  • store | your pixel code here | !clipboard <= Copy code to clipboard

  • XClick | xpath=.... <= set focus on the box (a normal CLICK should also work)

  • XType | ${KEY_CTRL+KEY_V} <=send ctrl+V to insert code from clipboard

Can You explain the problem because I don’t understand what kind of problem have and with what ui vision command.

Type paste every text you want