How can i set new style of element using selenium web-driver

后端 未结 1 606
失恋的感觉
失恋的感觉 2021-01-05 06:33

I am building test plan using (selenium webdriver - java) for page that contain button which open small color selection window.

this is the code of the right panel o

相关标签:
1条回答
  • 2021-01-05 07:15

    You can use findElement instead of getElementById,

    JavascriptExecutor js = (JavascriptExecutor) driver;
    WebElement element = driver.findElement(By.id("colorPickIcon"));
    js.executeScript("arguments[0].setAttribute('style', 'top:22.3333px')", element);
    

    You can refer the link How to use JavaScript with Selenium WebDriver Java

    0 讨论(0)
提交回复
热议问题