如何使用量角器验证srpTupleJson变量数据是在'list'还是'string'?

时间:2017-01-08 14:34:13

标签: list protractor

Html clode:

  <script>
            srpTupleJson = [{"name":"Praveen Mishra","title":"B.Tech in Computers Science with 1 year exp. in python\/django","isPremium":false,"isFeatured":false,"isNew":false,"employement":{"current":{"designation":"Python Developer","organization":"Freelancing  Project"},"previous":{"designation":"Python Developer","organization":"Derwent Technologies Pvt
</script>

如何使用量角器验证srpTupleJson数据是否在列表或字符串中。

1 个答案:

答案 0 :(得分:0)

这不是特定于量角器,它与javascript有关。

您可以使用typeof。例如:

if( typeof someVariable === 'object' ) {
    /* Do something */
}else if(typeof someVariable === 'string' ){
    /* Do something */
}