<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Xing Wu on Medium]]></title>
        <description><![CDATA[Stories by Xing Wu on Medium]]></description>
        <link>https://medium.com/@329106954?source=rss-25ffe79b6343------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EXMTOqG-iYEzQ4dEhE9vyQ.jpeg</url>
            <title>Stories by Xing Wu on Medium</title>
            <link>https://medium.com/@329106954?source=rss-25ffe79b6343------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 22:41:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@329106954/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Saving Data for Login in Pla]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Let&#x2019;s talk about Saving Data for Login of playwright this time.</p><p class="medium-feed-link"><a href="https://medium.com/@329106954/saving-data-for-login-in-pla-38c0eb880ef2?source=rss-25ffe79b6343------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@329106954/saving-data-for-login-in-pla-38c0eb880ef2?source=rss-25ffe79b6343------2</link>
            <guid isPermaLink="false">https://medium.com/p/38c0eb880ef2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Xing Wu]]></dc:creator>
            <pubDate>Sat, 25 May 2024 12:08:51 GMT</pubDate>
            <atom:updated>2024-05-25T12:08:51.386Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Use BurpSuite blasting password include VerificationCode]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">For the blasting with verification code, it is necessary to identify the verification code.</p><p class="medium-feed-link"><a href="https://medium.com/@329106954/use-burpsuite-blasting-password-include-verificationcode-ecbfc286e0cc?source=rss-25ffe79b6343------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@329106954/use-burpsuite-blasting-password-include-verificationcode-ecbfc286e0cc?source=rss-25ffe79b6343------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecbfc286e0cc</guid>
            <dc:creator><![CDATA[Xing Wu]]></dc:creator>
            <pubDate>Mon, 20 May 2024 06:39:52 GMT</pubDate>
            <atom:updated>2024-05-20T06:39:52.169Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Automation Journey of AXing (2) — Some common problems of PlayWright]]></title>
            <link>https://medium.com/@329106954/automation-journey-of-axing-2-some-common-problems-of-playwright-084804635800?source=rss-25ffe79b6343------2</link>
            <guid isPermaLink="false">https://medium.com/p/084804635800</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[it]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Xing Wu]]></dc:creator>
            <pubDate>Thu, 09 May 2024 14:28:04 GMT</pubDate>
            <atom:updated>2024-05-09T14:28:04.541Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automation Journey of AXing (2) — Some common problems of PlayWright</h3><h3>Write at the front</h3><p>I haven’t written about <em>playwright </em>for a long time, but I have used it a lot recently, and I decided to write down some common questions.</p><h3>installation via private network</h3><p>The intranet of my company is not connected to the Internet, there is only one ‘npm private source’, and the upstream source needs to be approved before it can be updated.</p><p>In human words, some package have, some package do not, and there is no way to pull the packages from the upstream source.</p><p>Fortunately, there is a lower version of `playwright`. <br>Unfortunately, several browser kernels need to be installed during installation, which cannot be downloaded on the intranet.</p><p>But luckily, in <a href="https://juejin.cn/post/7096074759158366221"><strong>an article</strong></a> casually clicked by the JueJin(A Chinese technology community), I saw that someone mentioned this.</p><p>Thank you for the author. <br>Here’s a quote.</p><blockquote>Create a new folder on a computer that can be accessed from the public network</blockquote><blockquote>`npm i @playwright/test -D`</blockquote><blockquote>If you have version restrictions like me, please download the package with the corresponding version number, for example, I use `1.24.3` here.</blockquote><blockquote>`npm i @playwright/test@1.24.3 -D`</blockquote><blockquote>then `npx playwright@1.24.3 install`</blockquote><blockquote>Visit `C:\Users\UserName\AppData\Local\ms-playwright`</blockquote><blockquote>MAC address is `/Users/username/Library/Caches/ms-playwrigh`</blockquote><blockquote>Compress it, then decompress it to the same address of the intranet computer, and then `npm install plawright@ 1.24.3`.</blockquote><p><a href="https://playwright.dev/docs/ci#caching-browsers"><strong>address </strong></a>of the official document</p><h3>Manipulate dom in iframe</h3><p>First find the id of `iframe`, and then find the corresponding dom through `iframe`</p><pre>const iframe = page.frameLocator(&#39;#my-iframe&#39;)<br>await iframe.locator(&quot;selectro&quot;).click()</pre><h3>get dom</h3><p>by `locator` to get `.elementHandles()`</p><pre>const elements = await page.locator(&#39;tr&#39;, { has: page.locator(&#39;text=&#39; + text), class: &#39;towntr&#39; }).elementHandles();<br>// get text<br>const text = await elements[0].innerText()</pre><h3>In some cases, the input box cannot be entered.</h3><p>Originally, for the input box, you should use `input () `to enter.</p><p>But there are always some strange situations that cannot be entered.</p><p>In this case, we can use `page.key` to manipulate keyboard input.</p><p>For example, I need to enter the account password.</p><pre>const account = &#39;&#39;<br>const password = &#39;&#39;</pre><pre>await page.keyboard.insertText(account);<br>await page.keyboard.press(&#39;Tab&#39;);</pre><pre>const pArray = password.split(&#39;&#39;);<br>for(let index = 0; index &lt; pArray.length; index ++){<br>  const element = pArray(index)<br>  await page.keyboard.down(element);<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=084804635800" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automation Journey of AXing (3) — PlayWright’s config]]></title>
            <link>https://medium.com/@329106954/automation-journey-of-axing-3-playwrights-config-ebf9ea9ac383?source=rss-25ffe79b6343------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebf9ea9ac383</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[free]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[it]]></category>
            <dc:creator><![CDATA[Xing Wu]]></dc:creator>
            <pubDate>Thu, 09 May 2024 14:26:02 GMT</pubDate>
            <atom:updated>2024-05-09T14:26:02.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automation Journey of AXing (3) — PlayWright’s config</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*agnL63Y1rv7zJyll.jpeg" /></figure><p>This page, we will talk about Playwright’s config</p><h3>1. keep login state</h3><p>When we test in some web</p><p>We need login every time</p><p>It’s so trouble</p><p>We can save login state, then we don’t need login every time</p><h4>(1) login first</h4><p>just login it</p><h4>(2) save login state</h4><p>save login state in file by `<em>context.storageState</em>`</p><p>Ex:</p><pre>   // save login state<br>    await context.storageState({<br>        path: dirPath + &#39;/auth/auth.json&#39;,<br>    })</pre><h4>(3) back to init browser code and inject state file</h4><pre>const authState = require(&#39;../auth/auth.json&#39;)<br>const browser = await chromium.launch({<br>        headless: false,<br>        // us edge<br>        channel: &#39;msedge&#39;,<br>    });<br>const context = await browser.newContext({<br>       storageState: authState ?? {},<br>});<br>const page = await context.newPage({});<br></pre><h4>2. ignore unsafe ssl cert</h4><p>In many websites, self-signed certificates are common</p><p>However, because there is no CA authentication for the self-signed certificate, the browser will report a non-dedicated link prompt</p><p><em>Playwright </em>will also have the same prompt when accessing such addresses, preventing normal automation from being done.</p><p>We can configure the settings for playwright to make browsers ignore such problems by default.</p><pre>    const browser = await chromium.launch({<br>        headless: false,<br>        channel: &#39;msedge&#39;,<br>    });<br>    const context = await browser.newContext({<br>        storageState: authState ?? {},<br>        // ignore https<br>        ignoreHTTPSErrors: true<br>    });<br>    const page = await context.newPage({<br>    });</pre><h4>3. upload file</h4><p>In some web page processes, you need to upload files. <br>For example, attachments need to be uploaded when sending an email. <br>It’s a little difficult at this time, because the box for uploading files, it’s not a web page, it’s a Windows program. <br>In fact, `<em>playwright</em>` has already dealt with this. You can use `<em>fileChooser</em>`.</p><pre>        // File path, absolute path!<br>        const filePath = &#39;xxxx&#39;<br>        const fileChooserPromise = page.waitForEvent(&#39;filechooser&#39;);<br>        await page.click(&#39;text=upload&#39;);<br>        const fileChooser = await fileChooserPromise;<br>        await fileChooser.setFiles(filePath);</pre><h4>4. download file</h4><p>For example, download the file under the current project path, etc.</p><pre>    const [download] = await Promise.all([<br>        // Specify waiting for download event<br>        page.waitForEvent(&#39;download&#39;),<br>        // click download button<br>        mainFrame.locator(&#39;xpath=xxx&#39;).click(),<br>    ]);<br>    // get file download path<br>    // const path = await download.path();<br>    // get file name, include suffix<br>    // const fileName = download.suggestedFilename();<br>    // set file name<br>    const fileName = &#39;xxxx&#39;<br>    // save file by filepath<br>    await download.saveAs(&#39;filepath&#39;);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebf9ea9ac383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automation Journey of AXing (1) — PlayWright]]></title>
            <link>https://medium.com/@329106954/automation-journey-of-axing-1-playwright-cefc20caf573?source=rss-25ffe79b6343------2</link>
            <guid isPermaLink="false">https://medium.com/p/cefc20caf573</guid>
            <category><![CDATA[it]]></category>
            <category><![CDATA[lazy]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Xing Wu]]></dc:creator>
            <pubDate>Mon, 06 May 2024 15:09:38 GMT</pubDate>
            <atom:updated>2024-05-07T15:04:20.431Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automation Journey of AXing (1) — PlayWright</h3><h3>Background</h3><p>There are some video learning tasks at work, requiring me to watch videos for learning throughout the day.</p><p>The main issue is that I cannot play the videos at a faster speed or in a continuous mode. I have to manually click on the next video, which is quite troublesome. Additionally, there are problem popups that appear randomly, and if I don’t answer them, the video won’t continue playing, even if I try to leave it playing unattended.</p><h3>Technical Selection</h3><p><strong><em>Selenium</em></strong>, need I say more? It’s definitely the big brother in this field.</p><p><strong><em>PlayWright</em></strong>, Microsoft’s newborn addition to the technology stack.</p><p>So I chose <strong><em>PlayWright</em></strong>. haha~</p><h3>Installing Edge on Linux</h3><p>Here comes the question, why should I install Edge? Isn’t Chrome good enough?</p><p>However, there’s an issue. When using <strong><em>chromedriver</em></strong>, it invokes Chromium, which by default does not support MP4-encapsulated H.264 encoded videos. Instead, it only supports Google’s native WebM-encapsulated VP9 encoded videos.</p><p>This is crucial for me, as my primary need is to watch videos.</p><p>Therefore, we choose Edge.</p><pre># installer in https://packages.microsoft.com/yumrepos/edge/<br>sudo yum localinstall https://packages.microsoft.com/yumrepos/edge/microsoft-edge-stable-105.0.1343.27-1.x86_64.rpm<br># install succesuccess？<br>microsoft-edge --version</pre><h3><strong>Open Edge</strong></h3><pre>const { chromium } = require(&#39;playwright&#39;);<br>const browser = await chromium.launch({<br>    // dedevelop false，deploy true<br>        headless: false,<br>        // using edge<br>        channel: &#39;msedge&#39;,<br>        // True！！！！only true can auto play vedio<br>        devtools: true<br>});</pre><h3>Finding DOM Elements with XPath</h3><p>Many people ask, “How do I use XPath? It’s so hard to calculate and complex!”</p><p>Honestly, guys, you don’t need to write XPath expressions yourself…</p><p>Let me give you an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dWhWMuUoMP7yOQ3UcUYf9g.png" /></figure><p>Just copy it.</p><h3>Some common operations</h3><h3>1. Focus on input and enter</h3><pre>// input dom focus by id <br>page.fill(&#39;#id&#39;, &#39;123456&#39;);</pre><h3>2. Click the button</h3><pre>// using xpath<br>await page.click(&#39;xpath=//html/body/form/div[2]/div/div[1]/input[4]&#39;)<br>// using text<br>await page.click(&#39;text=&#39; + &#39;Login&#39;)</pre><h3>3. Wait for a dom node to finish rendering</h3><pre>// For example, I am waiting for a picture to be rendered and get this picture.<br>const img0 = await page.waitForSelector(&#39;id=Img0&#39;);</pre><h3>4. Get all the dom that can be matched successfully</h3><pre>// It is especially effective when getting all columns or rows in a table<br>const domlist = await page.$$(&#39;xpath=//*[@id=&quot;mian&quot;]/form/div/table/tbody/tr/td/table[2]/tbody/tr/td/table[1]/tbody/tr/td/table/tbody/tr/td[1]/table/tbody/tr/td[2]/table[4]/tbody/tr/td[3]/span&#39;)</pre><h3>5. Browser back</h3><pre>await page.goBack()</pre><h3>6. Intercept network requests and replace results</h3><p>On the page initiated by the network request, use the following function</p><pre>const forbidRequest = async (page) =&gt; {<br>   // Parameters can be filled in the request address or regular expression, for example: / aaa$/ request that begins with aaa<br>   page.route(&#39;参数&#39;, async route =&gt; {<br>   // Fetch original response.<br>     const response = await page.request.fetch(route.request());<br>     // Add a prefix to the title.<br>     let body = {}<br>     // Note here that you must convert the json string<br>     const result = JSON.stringify(body)<br>     route.fulfill({<br>       // Pass all fields from the response.<br>       response,<br>       // Override response body.<br>       body:result,<br>     });<br>   });<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cefc20caf573" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First article，follow back in 24h]]></title>
            <link>https://medium.com/@329106954/my-first-article-follow-back-in-24h-2c5de1bd5578?source=rss-25ffe79b6343------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c5de1bd5578</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[followers]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Xing Wu]]></dc:creator>
            <pubDate>Mon, 06 May 2024 14:30:11 GMT</pubDate>
            <atom:updated>2024-05-06T14:35:05.164Z</atom:updated>
            <content:encoded><![CDATA[<h3>My first article, follow back within 24 hours</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*QIie2wx8ZNjQ3Yc65wGYlA.png" /></figure><p>Hello everyone, I’m AXing.</p><p>I’ve joined Medium, and this is my first article.</p><p>Let me introduce myself.</p><p>I’m a freelance developer who has worked with various companies. I’ve written code for clients, web, and I’ve also done Operations Engineer and Test Engineer.</p><p>Occasionally, I even dabble in the role of a white hat hacker.</p><p>This is my first article here.</p><p>I hope you guys can give me a like and a follow.</p><p>I will maintain my creativity and share some of my ideas and code.</p><p>I will follow back anyone who follows me within 24 hours.</p><p>Thank you for reading.</p><p>We’ll see you again in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c5de1bd5578" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>