<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Erxin, Shang(Edwin, 尚尔鑫)&#039;s Home Page &#187; truclient</title>
	<atom:link href="http://www.shangerxin.com/?feed=rss2&#038;tag=truclient-2" rel="self" type="application/rss+xml" />
	<link>http://www.shangerxin.com</link>
	<description>Knowledge should be free.</description>
	<lastBuildDate>Tue, 24 Aug 2021 02:27:23 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.13</generator>
	<item>
		<title>Handling None Standard File Upload with TruClient</title>
		<link>http://www.shangerxin.com/?p=319</link>
		<comments>http://www.shangerxin.com/?p=319#comments</comments>
		<pubDate>Sun, 05 Nov 2017 05:39:37 +0000</pubDate>
		<dc:creator><![CDATA[Shang Erxin]]></dc:creator>
				<category><![CDATA[TruClient]]></category>
		<category><![CDATA[truclient]]></category>

		<guid isPermaLink="false">http://www.shangerxin.com/?p=319</guid>
		<description><![CDATA[First let&#8217;s explain what is the &#8220;none standard file upload&#8221; for a website. Let a user upload a file is a very common use case for a website. The most common way to implement this would be &#160; Then post the file content with form to the server. This is the standard way to upload [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>First let&#8217;s explain what is the &#8220;none standard file upload&#8221; for a website. Let a user upload a file is a very common use case for a website. The most common way to implement this would be</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">input</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></div></li></ol></pre></div></div>
<p>&nbsp;</p>
<p>Then post the file content with form to the server. This is the standard way to upload a file with HTML. The standard way have several limitation. The most significant is difficult to customize the style for the upload file control.</p>
<p>So the none standard file upload come up with this requirement. The main idea is let the web designer customize the looking as they preferred. After the user click the control then dynamically create an input element or trigger a hidden input click in the background. This make the upload control looks much better, but it lead the feature hard for automation UI test. The common automation tools such as selenium(webdriver) and jmeter do not provide a elegant way to handle none standard upload. The reason is due to the input element is dynamically created which nearly impossible to locate it with CSS selector or XPath.</p>
<p>In TruClient 12.55+ which provide a easy way to handle none standard file upload.</p>
<p>Here is a simply code snippet for demo none standard file upload with jsfiddle at <a title="http://jsfiddle.net/erxin/o4menymo/" href="http://jsfiddle.net/erxin/o4menymo/"> http://jsfiddle.net/erxin/o4menymo/</a></p>
<div id="attachment_323" style="width: 1376px" class="wp-caption aligncenter"><a href="http://jsfiddle.net/erxin/o4menymo/"><img class="size-full wp-image-323" alt="None standard file upload code sample" src="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/11/2017-11-05_133707.png" width="1366" height="647" /></a><p class="wp-caption-text">None standard file upload code sample</p></div>
<p>1. Drag a &#8220;General Object Action&#8221; step<br />
2. Select the aim object which the user will click to upload the file<br />
3. Change the step type from &#8220;Click&#8221; to &#8220;Upload&#8221;<br />
4. Assign the right file path to the &#8220;Path&#8221; parameter<br />
5. Done.<br />
<a href="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/11/none-standard-upload.gif"><img class="aligncenter size-full wp-image-326" alt="none-standard-upload" src="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/11/none-standard-upload.gif" width="1364" height="736" /></a></p>
<p>Currently the none standard file upload step only support in TruClient Chrome and IE. The Firefox version will coming soon. </p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shangerxin.com/?feed=rss2&#038;p=319</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip for Easily Backup Local Script Files in TruClient Lite Chrome</title>
		<link>http://www.shangerxin.com/?p=306</link>
		<comments>http://www.shangerxin.com/?p=306#comments</comments>
		<pubDate>Tue, 21 Feb 2017 13:35:31 +0000</pubDate>
		<dc:creator><![CDATA[Shang Erxin]]></dc:creator>
				<category><![CDATA[TruClient]]></category>
		<category><![CDATA[truclient]]></category>

		<guid isPermaLink="false">http://www.shangerxin.com/?p=306</guid>
		<description><![CDATA[Currently TruClient Lite Chrome doesn’t support batch script operations. If the user want to back up all the local scripts, then they have to manually download the scripts one by one. There are two ways to back up the scripts All the scripts are saved in the user data directory. So back up the user [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Currently TruClient Lite Chrome doesn’t support batch script operations. If the user want to back up all the local scripts, then they have to manually download the scripts one by one.<br />
There are two ways to back up the scripts</p>
<ol>
<li>All the scripts are saved in the user data directory. So back up the user data directory will back up the script indirectly.</li>
<li>We could use a hack way to download all the scripts as a single zip file.</li>
</ol>
<p>Steps to back up user data folder</p>
<ol>
<li>Check the path from the command line of the shortcut of your TruClient Lite Chrome<br />
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><div class="bash" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #660033;">--user-data-dir</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>profile <span style="color: #c20cb9; font-weight: bold;">dir</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">--extensions-on-chrome-urls</span> <span style="color: #660033;">--silent-debugger-extension-api</span> <span style="color: #660033;">--disable-web-security</span> <span style="color: #660033;">--no-first-run</span></div></li>
</ol></div></div></div></li>
<li>Back up the folder &lt;profile dir&gt;</li>
</ol>
<p>Steps to download all the scripts as a single zip file</p>
<ol>
<li>Start the TruClient Lite</li>
<li>Navigate to chrome://extensions/ to open the extension management pages for Chrome</li>
<li>Check the Developer mode<br />
<a href="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/02/extension-enable-dev-mode.png"><img class="alignnone size-medium wp-image-309" alt="extension-enable-dev-mode" src="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/02/extension-enable-dev-mode-300x129.png" width="300" height="129" /></a></li>
<li>Click background page link for TruClient Lite<br />
<a href="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/02/extension-page.png"><img class="alignnone size-medium wp-image-310" alt="extension-page" src="http://www.shangerxin.com/wordpress/wp-content/uploads/2017/02/extension-page-300x130.png" width="300" height="130" /></a></li>
<li>Run the below code on console, the scripts will be saved<br />
	<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.shangerxin.com/wordpress/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><div class="javascript" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">var zip = new JSZip(); localforage.iterate((v, k) =&gt; { if(k.startsWith('/__scripts__/') &amp;&amp; k.indexOf(':metadata:') === -1){ zip.file(k.split('/').pop()+'.zip', v); } }).then(()=&gt;{ a = document.createElement('a'); a.href = window.URL.createObjectURL(zip.generate({type:&quot;blob&quot;})); a.download = &quot;scripts.zip&quot;; a.dispatchEvent(new MouseEvent(&quot;click&quot;)); });</div></li>
</ol></div></div></div></li>
<li>Restart TruClient Lite</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.shangerxin.com/?feed=rss2&#038;p=306</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
