[英]How can I get same innertext ptoperty value in all browsers (IE, Chrome and Firefox)
I am new to selenium. 我是硒新手。 I am doing cross browser testing using CUIT.
我正在使用CUIT进行跨浏览器测试。 Whenever I record action in IE and playback in chrome my tests are failing because of innertext property value is different in IE and Chrome.
每当我在IE中记录操作并在chrome中播放时,由于IE和Chrome中的innertext属性值不同,测试都会失败。
Most of my test scripts are depending on innertext property. 我的大多数测试脚本都取决于innertext属性。
Is there any way (common converter) to get same innertext property value in all browsers? 有没有办法(通用转换器)在所有浏览器中获得相同的innertext属性值?
If I use Selenium to test my application in all browsers. 如果我使用Selenium在所有浏览器中测试我的应用程序。 Is selenium returns same innertext value in all browsers?
硒是否在所有浏览器中返回相同的内部文本值?
CUIT forum query link https://social.msdn.microsoft.com/Forums/vstudio/en-US/201b6822-5ea9-4a8f-983d-fcc5d3d12f0b/cross-browser-testing-in-coded-ui-problem-with-considering-spaces?forum=vstest#86a5bacb-fbc5-4224-983f-d43504c693b0 CUIT论坛查询链接https://social.msdn.microsoft.com/Forums/vstudio/en-US/201b6822-5ea9-4a8f-983d-fcc5d3d12f0b/cross-browser-testing-in-coded-ui-problem-with-考虑空间?forum = vstest#86a5bacb-fbc5-4224-983f-d43504c693b0
innerText is old way of using with Internet Explorer. innerText是与Internet Explorer结合使用的旧方法。 Instead you can use textContent .
相反,您可以使用textContent 。
Here's code: 这是代码:
var domElement = document.getElementById("txtUserName");
var output = domElement.textContent || domElement.innerText;
If you are using jQuery in your project, you can use .text() since it is designed to support cross-browsers 如果您在项目中使用jQuery,则可以使用.text(),因为它旨在支持跨浏览器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.