Using autonomy to log on to saleforce.com on Linux (with no gui), JS and VB errors

BACKGROUND: The script below logs into my salesforce.com account and tries to click a bunch of download links and save the local .zip export files.

I use jruby and celerity (this is the jruby shell around htmlunit, a headless browser that also supports javascript).

The requirement is that it is executed from the LINUX command line without a GUI / browser installed. A browser without a headset must also support javascript, otherwise it salesforce.comreturns an error and will not display download links. (I tried CURL, but it fails because it does not support javascript). (Currently, the script works great when run from the command line in the WINDOWS window)

Question: When I try to run this from the linux window, I get the error below, and the script is not logged in to enter salesforce. I believe the .js warning is ok (I think), but I don't understand what the warning means VBScript not supported in Window.execScript()?:

[root@ip-10-114-241-55 ~]# jruby download_sf_export_files.rb
Jan 18, 2011 2:16:41 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://www.salesforce.com/common/assets/js/global2.js?date=100817', but got 'application/x-javascript'.
Jan 18, 2011 2:16:41 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://www.salesforce.com/common/assets/thirdparty/omniture/s_code3.js?date=101012', but got 'application/x-javascript'.
Jan 18, 2011 2:38:05 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://na7.salesforce.com/static/101210/js/functions.js', but got 'application/x-javascript'.
Jan 18, 2011 2:38:06 AM com.gargoylesoftware.htmlunit.javascript.host.Window jsxFunction_execScript
WARNING: VBScript not supported in Window.execScript().



-----install instructions------
download jruby:                 http://jruby.org/download
install gem from command line:  jruby -S gem install celerity
run script from command line:   jruby download_sf_export_files.rb

-----download_sf_export_files.rb-------
require "rubygems"
require "celerity"

browser = Celerity::Browser.new
browser.goto('https://na7.salesforce.com')
browser.text_field(:name, 'username').value = 'myuserlogin@domain.com'
browser.text_field(:name, 'pw').value = 'mysecretpassword'
browser.button(:name, 'Login').click
browser.goto('https://na7.salesforce.com/ui/setup/export/DataExportPage/d')

## assume multiple 'download' links if a large SF data export 
## group all links in a map, iterate and click each one

i=1
hrefs = browser.links.map { |link| link.href if link.text =~ /download/ }.compact hrefs.each do |href|
 browser.link(:url, href).download
 puts "found a 'download' link on page, clicking link..."
 io = browser.link(:text, "download").download 
 File.open("sf_zip_file_#{i}.zip", "w+") { |file| file.write(io.read) }
 i+=i
end
+3
source share
1 answer

( , " " )

Celerity "" ? , , , HTTP-, , , ... ( IP , , , , Celerity, cookie).

+3

Source: https://habr.com/ru/post/1786483/