javascript - 您好,如何单击 ctrl + 鼠标左键单击。在 webdriver.io js 中
问题描述
您好,我想知道如何单击 ctrl + 鼠标左键单击。在 webdriver.io js 我试过这样
it("Perform Actions",async()=>{
await browser.url("https://www.seleniumeasy.com/test/basic-select-dropdown-demo.html") ;
const element1 = $('//option[ @value="California" ]')
const element2 = $('//option[ @value="Florida" ]')
const element3 = $('//option[ @value="New Jersey" ]')
const element4 = $('//option[ @value="Ohio" ]')
const firstSelected = $('//button[@id="printMe"]');
const allSelected = $('//button[@id="printAll"]')
const result = $('//p[@class="getall-selected"]')
await element1.click().keys("ControlLeft");
await element2.click().keys("ControlLeft");
await element3.click().keys("ControlLeft");
await element4.click().keys("ControlLeft");
await firstSelected.click()
expect (await result.getText()).toEqual("First selected option is : California")
;
})