开发者

Is there a way to encrypt passwords in Ruby Watir automation scripts?

开发者 https://www.devze.com 2023-04-05 02:04 出处:网络
I need to create an automated test using Watir that requires a password to be written into a text field, but I don\'t want to have the password in plain view in the script.Is there a way to encrypt/de

I need to create an automated test using Watir that requires a password to be written into a text field, but I don't want to have the password in plain view in the script. Is there a way to encrypt/decrypt a password within Watir?

I know python uses the base64 lib to do it, but I'm not sure how Ruby would do it.

Here's the code:

require 'watir'
ie = IE.new
ie.goto("https://test.domain.com")
ie.text_field(:name, "us开发者_运维知识库ername").set("myUsername")
ie.textfield(:name, "password")set("myPassword")


Your test server shouldn't have sensitive data, and it shouldn't be publicly accessible. What danger are you trying to protect against / what damage can an unauthorized person do if they got the password? If it's really a test server, it seems like the worst case is that someone would mess with your test data.

Using base64 would only be security by obscurity because it's so easy to decode. If you really think this is sufficient for your needs, just use Base64.encode64 and Base64.decode64 .

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号