Ruby on rails Ocra生成的exe不';t接受论点
am像这样使用ocra构建.exeRuby on rails Ocra生成的exe不';t接受论点,ruby-on-rails,ruby,selenium-webdriver,command-line-arguments,ocra,Ruby On Rails,Ruby,Selenium Webdriver,Command Line Arguments,Ocra,am像这样使用ocra构建.exeocra testing.rb--sample 这里我将“sample”作为参数传递给下面的代码并构建一个exe require "selenium-webdriver" $var = ARGV[0] driver = Selenium::WebDriver.for :chrome wait = Selenium::WebDriver::Wait.new(:timeout => 20) puts $var driver.navigate.to "
ocra testing.rb--sample
这里我将“sample”作为参数传递给下面的代码并构建一个exe
require "selenium-webdriver"
$var = ARGV[0]
driver = Selenium::WebDriver.for :chrome
wait = Selenium::WebDriver::Wait.new(:timeout => 20)
puts $var
driver.navigate.to "https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2&emr=1&osid=1#identifier"
sleep 5
input = driver.find_element(:id, "Email")
input.send_keys($var)
button = driver.find_element(:id, "next")
button.click
sleep 5
这里的问题是,在构建.exe之后,当我试图通过传递不同的参数(值)来运行exe时,它总是将与“sample”相同的值作为硬代码传递给参数
C:\Users\shivaj\Downloads>testing.exe--test1
它把它作为样本
请帮我解决这个问题,我刚刚制作了一个有问题的示例程序,但实际的程序与此有更多的关系。感谢您的帮助。谢谢你的帮助 目前Ocra不支持:我想这是因为您将参数分配给变量,并且在构建exe时提供了一个参数 我使用一些使用参数并使用ocra转换为exe的脚本 我所做的是
ARGV.each do|arg|
# do whatever with arg
end
然后,当您构建exe时,您不提供参数,代码将正常运行,因为ARGV将在那里但为空。太好了!我的计算方法不同,但逻辑是一样的。非常感谢。