ติดตั้ง Appium Inspector เพื่อใช้หา Element
เราสามารถใช้ appium instector ได้จาก 2 ช่องทางคือ
1. ผ่านทางหน้าเว็บ https://inspector.appiumpro.com/
2. ดาวน์โหลดและติดตั้งโปรแกรม Appium Inspector จากเว็บไซต์ https://github.com/appium/appium-inspector/releases
ทำการติดตั้ง Appium Server
1. เปิด command line ขึ้นมา (run –> cmd)
2. รันคำสั่ง npm install -g appium
ทำการติดตั้ง AppiumLibrary เพื่อทำการเรียกใช้ appium ใน robot framework
1. ติดตั้ง robot framework สำเร็จ
2. เปิด command line ขึ้นมา (run –> cmd)
3. รันคำสั่ง pip install robotframework-appiumlibrary
4. ทำการเช็คว่าติดตั้งสำเร็จหรือไม่โดยการรันคำสั่ง pip list

5. จะพบ robotframework-appiumlibrary ปรากฏอยู่
ทดลองสร้าง android Emulator และเชื่อมต่อ android กับ appium
สร้าง android Emulator
1. เปิดโปรแกรม android Studio
2.เลือกเมนู More Action
3. เลือกเมนู AVD Manager

4. กดปุ่ม + Create Virtual Device.. เพื่อทำการเพิ่ม Devic android

5. เลือกรุ่น และสเปคของโทรศัพท์ที่ต้องการใช้ทดสอบ หลังจากนั้นกดปุ่ม Next

6. เลือก Image ที่ต้องการหลังจากนั้นกด Next

7. ทำการตั้งค่า AVD Name ตามที่ต้องการ โดยค่านี้จะถูกนำไปใช้ใน appium:deviceName ตอนเชื่อมต่อกับ Appium หลังจากนั้นกด Finish

8. โดยเมื่อทำการสร้างสำเร็จ เราจะได้ Device ใหม่ขึ้นมาหนึ่งตัว
9. ทำการ start device โดยการกดปุ่ม Play ระบบจะทำการเปิด Emulator มาให้

เมื่อต้องการจะติดตั้งโปรแกรมที่จะทำการทดสอบลงในเครื่อง Emulator ให้ทำการลากไฟล์ .apk ลงมาที่เครื่องได้ทันที และระบบจะทำการติดตั้งโปรแกรมดังรูป

ทำการเชื่อมต่อ Appium กับ android Emulator เพื่อค้นหา Element
เมื่อทำการ Start Emulator สำเร็จ ให้ทำการเปิดโปรแกรม Appium
1. กรอก Host : 127.0.0.1 และ Port : 4723
2. หลังจากนั้นกด startServer

3. เปิดโปรแกรม Appium Inspector

4. กรอก Remote Host, Port ตามตอนที่ทำการ Start Server
กรอก Desired Capabilities อ่านเพิ่มเติมได้ใน Desired Capabilities – Appium
{
“appium:deviceName”: “<ชื่อ AVD Name>”,
“appium:platformVersion”: “<Version android>”,
“appium:platformName”: “Android”,
“appium:app”: “<Path ที่อยู่ของไฟล์ .apk>”,
“appium:appWaitActivity”: “*” => ให้ระบบรอหน้าเว็บดาวน์โหลดทั้งหมด
}
5. กดปุ่ม Start Session
6. จะได้หน้าจอที่ปรากฏแอพที่เราต้องการ