如何使用selenium webdriver ruby 测试调色板。我尝试使用下面的代码,但它不起作用
location=driver.find_element(:id,"color-palette").location
driver.mouse.move_to(driver.find_element(:id,"color-palette"),location.x,location.y).click
如何使用selenium webdriver ruby 测试调色板。我尝试使用下面的代码,但它不起作用
location=driver.find_element(:id,"color-palette").location
driver.mouse.move_to(driver.find_element(:id,"color-palette"),location.x,location.y).click
以下代码应该可以实现您想要实现的目标。如需进一步参考,请参见此处
el = driver.find_element(:id, "color-palette")
driver.action.click(el).perform
或尝试更改您的代码
driver.mouse.move_to(driver.find_element(:id,"color-palette"),location.x,location.y).click
至
driver.action.move_to(driver.find_element(:id,"color-palette"),location.x,location.y).click