简体   繁体   English

隐藏/删除 Internet Explorer 上文本输入的插入符号 (11)

[英]Hide/Remove insertion caret for text-inputs on Internet Explorer(11)

I am working with WebdriverIO selenium tests, I have cases where the screenshot comparisons fails and the tests fails because of the blinking insertion cursor.我正在使用 WebdriverIO selenium 测试,我遇到了屏幕截图比较失败并且由于插入光标闪烁而导致测试失败的情况。

For Chrome I have circumvented this issue by having a button for my component screenshots that I click before asserting the screenshots which hides the caret using the code对于 Chrome,我通过为我的组件屏幕截图设置一个按钮来规避此问题,然后在使用代码声明隐藏插入符号的屏幕截图之前单击该按钮

dropdownInput.style.caretColor = "#0000";

But for Intenet explorer the caret-color property is not supported, I have tried using the color: transparent;text-shadow: 0 0 0 #000;但是对于 Internet Explorer 不支持caret-color属性,我尝试使用color: transparent;text-shadow: 0 0 0 #000; , and several other examples but I cannot get it to work. ,以及其他几个示例,但我无法让它工作。

If there is any way to solve this using JavaScript, the WebdriverIO API, or some npm package or any solution, please share with me guys thanks.如果有任何方法可以使用 JavaScript、WebdriverIO API 或一些 npm 包或任何解决方案来解决这个问题,请与我分享,谢谢。

I have found a work around to prevent the selenium tests from failing by following on the following on the issue: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10655065/ .我找到了一种解决方法,通过遵循以下问题来防止硒测试失败: https : //developer.microsoft.com/en-us/microsoft-edge/platform/issues/10655065/

That is, changing the background-color of the text-input to #7F7F7F , this will hide the visibility of the insertion caret.也就是说,将文本输入的背景颜色更改为#7F7F7F ,这将隐藏插入符号的可见性。 This is not an official solution as the screenshots will differ from the ones I have with the react-storybook because of this background-color , this is just to avoid the failing tests because of the blinking insertion caret on Chrome <54 and Internet Explorer/MS Edge .这不是官方解决方案,因为屏幕截图将与我使用 react-storybook 的截图不同,因为这种background-color ,这只是为了避免由于Chrome <54Internet Explorer/MS Edge上闪烁的插入符号而导致测试失败Internet Explorer/MS Edge

I will post a rather better solution soon.我很快会发布一个更好的解决方案。

UPDATE: This is in the past, I don't know the status of this now更新:这是过去,我不知道现在的状态

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM