TIP : วิธีการการ GET URL จาก Tag A Selenium IDE
โพสต์แล้ว: 27/11/2015 5:02 pm
เป็นอีกหนึ่งวิธี เนื่องจาก Selenium IDE ไม่ซัพพอร์ต tag _blank ซื่งเวลา Selenium IDE มันอ่านค่า click มันจะเปิดเป็นอีก 1 วินโดว์
แต่เวลาเราใช้เมาส์เปิดเองมันจะเปิดเป็นแท็ปอีกแท็ป
1.ตัวอย่างการเข้า Tag A
เก็บ link ลงไปในตัวแปร test
command: storeAttribute
target: //a@href
value: test
เรียกใช้ตัวแปร test
command: open
target: ${test}
value:
** คำอธิบาย
เมือเจอคำสั่ง open จะวิ่งเข้าไปหา link ตัวแรกเสมอ หน้าเว็ปก็จะลิ้งไปที่ Google.com
2.ตัวอย่างการเข้า Tag A ตามลำดับ[]
เก็บ link ลงไปในตัวแปร test
command: storeAttribute
target: //a[2]@href
value: test
เรียกใช้ตัวแปร test
command: open
target: ${test}
value:
** คำอธิบาย
เมือเจอคำสั่ง open จะวิ่งเข้าไปหา link ตัว2ซึ่งเรากำหนดไว้ a[2]@href หน้าเว็ปก็จะลิ้งไปที่ Youtube.com
แต่เวลาเราใช้เมาส์เปิดเองมันจะเปิดเป็นแท็ปอีกแท็ป
1.ตัวอย่างการเข้า Tag A
โค้ด: เลือกทั้งหมด
<a href="http://www.google.co.th" target="_blank">Google</a>
<a href="http://www.youtube.com" target="_blank">Youtube</a>
command: storeAttribute
target: //a@href
value: test
เรียกใช้ตัวแปร test
command: open
target: ${test}
value:
** คำอธิบาย
เมือเจอคำสั่ง open จะวิ่งเข้าไปหา link ตัวแรกเสมอ หน้าเว็ปก็จะลิ้งไปที่ Google.com
2.ตัวอย่างการเข้า Tag A ตามลำดับ[]
เก็บ link ลงไปในตัวแปร test
command: storeAttribute
target: //a[2]@href
value: test
เรียกใช้ตัวแปร test
command: open
target: ${test}
value:
** คำอธิบาย
เมือเจอคำสั่ง open จะวิ่งเข้าไปหา link ตัว2ซึ่งเรากำหนดไว้ a[2]@href หน้าเว็ปก็จะลิ้งไปที่ Youtube.com