C
Camael Ye
I have a login page,it includes a form,this form includes two text,one
is username and another is password.By manual,when you input
username,password and click submit button,you will see a welcome page,my
question is how to submit a form and get welcome page's content by ruby
code,now,I can post username and password data into login page but I
cannot submit this page success and get welcome page.
require 'net/http'
require 'uri'
url = "http://192.168.1.3:8081/cstk-auto/login/logout.action"
uri = URI.parse(url)
puts uri.host
puts uri.port
http = Net::HTTP.start(uri.host, uri.port)
response = http.request_post(uri.path,"username=admin&password=123456")
puts response.inspect
if (response.code[0,1] == "2" && response.body != "0")
puts response.body
end
Thanks
is username and another is password.By manual,when you input
username,password and click submit button,you will see a welcome page,my
question is how to submit a form and get welcome page's content by ruby
code,now,I can post username and password data into login page but I
cannot submit this page success and get welcome page.
require 'net/http'
require 'uri'
url = "http://192.168.1.3:8081/cstk-auto/login/logout.action"
uri = URI.parse(url)
puts uri.host
puts uri.port
http = Net::HTTP.start(uri.host, uri.port)
response = http.request_post(uri.path,"username=admin&password=123456")
puts response.inspect
if (response.code[0,1] == "2" && response.body != "0")
puts response.body
end
Thanks