在强制性文本字段中输入正确的文本之前和之后,捕获文本框的颜色
我正在尝试在 Salesforce Lightning(销售应用程序)中测试新的潜在客户创建。当在显示的必填字段中输入正确的文本时,文本框元素周围的颜色会发生变化(从白色变为浅黄色),如下图所示。我尝试通过传递“背景颜色”和“颜色”属性,通过 selenium 的 getCssValue(String attribute) 方法捕获该值,但无济于事。请告诉我们如何在 Selenium 之前和之后获得这种颜色变化。在必填字段中输入文本后(例如姓氏)。我们将非常感谢您的帮助。 (注意:请忽略红色下划线。我用它通过截图工具突出显示该字段)
I'm trying to test new lead creation in Salesforce Lightning (Sales app). When correct text is entered into the shown mandatory field(s), the color around text box element changes (from white to light yellow) as shown in images below. I've tried capturing that via getCssValue(String attribute) method of selenium by passing 'background-color' and 'color' attributes, but to no avail. Please tell how to get this color change in Selenium before & after text is entered in mandatory field (e.g Last Name). Your help would be highly appreciated. (Note: Please overlook the red underline. I used it to highlight the field via Snipping Tool)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过以下方式获取元素颜色(元素的背景颜色):
您可以通过以下方式获取元素文本/标题颜色:
例如,如果您想获取LinkedIn“登录”按钮的背景和文本颜色,代码如下如下:
不要忘记导入
上面的代码将返回rgb值。如果你想转换成十六进制,你可以去
Selenium WebDriver 中十六进制格式的 getCssValue(颜色)
You can get the element color(Background color of element) by:
You can get the element text/caption color by:
For example if you want to get the background and text color of "Sign in" button for LinkedIn, the code is as follows:
do not forget to import
The above code will return rgb value. If you want to convert to hex, you can go to
getCssValue (Color) in Hex format in Selenium WebDriver