溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Appium和UIAutomator英文和數(shù)字輸入問題記錄

發(fā)布時間:2020-06-26 13:50:43 來源:網(wǎng)絡(luò) 閱讀:1206 作者:zhukev 欄目:開發(fā)技術(shù)

Appium對中文支持有問題已經(jīng)是眾所周之得了,但是今天用Appium編寫一個創(chuàng)建Note的實例的時候發(fā)現(xiàn)Appium對含有英文和數(shù)字的字串輸入也有問題。</span>

比如如果想用driver.sendkeys來輸入“Note1",事實上你會得到的是Note。實踐中發(fā)現(xiàn)如果英文字串和數(shù)字之間加多一個空格就能解決問題,比如輸入”Note 1",最終得到的就會是"Note1".

實踐發(fā)現(xiàn)UIAutomator存在同樣的問題,因為Appium底層調(diào)用的就是UIAutomator,所以最終的Bug應(yīng)該是是屬于UIAutomator這一邊的。

以下Appium代碼可以驗證這個問題:

        //Enter the note info and save it         WebElement text = driver.findElementByClassName("android.widget.EditText");        <span style="color:#ff0000;"> text.sendKeys("Note 1");</span>                  driver.sendKeyEvent(82);         el = driver.findElement(By.name("Save"));         el.click();                  //Find out the new added note entry         List <WebElement> entries = driver.findElements(By.className("android.widget.TextView"));                  WebElement targetEntry = null;         for(WebElement entry : entries) {         	<span style="color:#ff0000;">if(entry.getText().equals("Note1")) </span>{         		targetEntry = entry;         		break;         	}         }


<source id="61616"></source>
<noscript id="61616"></noscript>
      1. <source id="61616"></source>
           

          作者

          自主博客

          微信

          CSDN

          天地會珠海分舵

          http://techgogogo.com


          服務(wù)號:TechGoGoGo

          掃描碼:

          Appium和UIAutomator英文和數(shù)字輸入問題記錄

          向AI問一下細(xì)節(jié)

          免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

          AI