Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Selenium 的新手。我想断言特定屏幕的背景颜色。如何使用 Selenium rc 断言背景颜色?
您可以通过从正文中检索背景颜色来获取它。应该是这样的:
WebElement body = driver.findElement(By.cssSelector("body")); String color = body.getAttribute("bgcolor");