Hope you Guys are doing good. I have 1 issue with my project functionality. I have 1 form in that form we have few fields and in last we have submit and download button. when we will click on submit and download button that time we will this error.
POST https://admin.default.com/manage_doc_download_popup/ajax/2091/674?token=... 500 (Service unavailable (with message)) Response Text: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"capstore","theme_token":"gcu_X3w1KcbG7Lq6TmlXVMOupzbkdowwVgbpz_a-Xlo","js":{"sites\/all\/modules\/contrib\/ctools\/js\/ajax-responder.js":1}},"lightbox2":{"rtl":0,"file_path":"\/(\\w\\w\/)public:\/","default_image":"\/sites\/all\/modules\/contrib\/lightbox2\/images\/brokenimage.jpg","border_size":10,"font_color":"000","box_color":"fff","top_position":"","overlay_opacity":"0.8","overlay_color":"000","disable_close_click":1,"resize_sequence":0,"resize_speed":400,"fade_in_speed":400,"slide_down_speed":600,"use_alt_layout":1,"disable_resize":0,"disable_zoom":0,"force_show_nav":1,"show_caption":0,"loop_items":0,"node_link_text":"View Image Details","node_link_target":0,"image_count":"Image !current of !total","video_count":"Video !current of !total","page_count":"Page !current of !total","lite_press_x_close":"press \u003Ca href=\u0022#\u0022 onclick=\u0022hideLightbox(); return FALSE;\u0022\u003E\u003Ckbd\u003Ex\u003C\/kbd\u003E\u003C\/a\u003E to close","download_link_text":"Download Original","enable_login":false,"enable_contact":false,"keys_close":"c x 27","keys_previous":"p 37","keys_next":"n 39","keys_zoom":"z","keys_play_pause":"32","display_image_size":"","image_node_sizes":"()","trigger_lightbox_classes":"","trigger_lightbox_group_classes":"","trigger_slideshow_classes":"","trigger_lightframe_classes":"","trigger_lightframe_group_classes":"","custom_class_handler":0,"custom_trigger_classes":"","disable_for_gallery_lists":true,"disable_for_acidfree_gallery_lists":true,"enable_acidfree_videos":true,"slideshow_interval":5000,"slideshow_automatic_start":true,"slideshow_automatic_exit":true,"show_play_pause":true,"pause_on_next_click":false,"pause_on_previous_click":true,"loop_slides":false,"iframe_width":900,"iframe_height":520,"iframe_border":0,"enable_video":1,"useragent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/86.0.4240.193 Safari\/537.36","flvPlayer":"\/sites\/default\/files\/DCXCOE_DX_sv.mp4","flvFlashvars":""},"overlay":{"paths":{"admin":"file\/*\/downloads\nfile\/add\nfile\/add\/*\nfile\/*\/edit\nfile\/*\/usage\nfile\/*\/delete\nnode\/*\/edit\nnode\/*\/delete\nnode\/*\/revisions\nnode\/*\/revisions\/*\/revert\nnode\/*\/revisions\/*\/delete\nnode\/add\nnode\/add\/*\noverlay\/dismiss-message\nuser\/*\/shortcuts\nadmin\nadmin\/*\nbatch\ntaxonomy\/term\/*\/edit\nuser\/*\/cancel\nuser\/*\/edit\nuser\/*\/edit\/*\nnode\/*\/moderation\nnode\/*\/moderation\/*\/unpublish\nnode\/*\/moderation\/*\/change-state\/*\nnode\/*\/moderation\/view\nnode\/*\/moderation\/diff\nnode\/*\/moderation\/diff\/list\nnode\/*\/moderation\/diff\/view\nnode\/*\/moderation\/diff\/view\/*\/*","non_admin":"admin\/structure\/block\/demo\/*\nadmin\/reports\/status\/php"},"pathPrefixes":[],"ajaxCallback":"overlay-ajax"},"bootstrap":{"anchorsFix":"0","anchorsSmoothScrolling":"0","formHasError":1,"popoverEnabled":1,"popoverOptions":{"animation":1,"html":0,"placement":"right","selector":"","trigger":"click","triggerAutoclose":1,"title":"","content":"","delay":0,"container":"body"},"tooltipEnabled":1,"tooltipOptions":{"animation":1,"html":0,"placement":"auto left","selector":"","trigger":"hover focus","delay":0,"container":"body"}}},"merge":true},{"command":"insert","method":"prepend","selector":"head","data":"\u003Cscript src=\u0022https:\/\/admin.default.com\/sites\/all\/modules\/contrib\/ctools\/js\/ajax-responder.js?qjdm9a\u0022\u003E\u003C\/script\u003E\n","settings":null},{"command":"invoke","selector":".comment-form","method":"show","arguments":[]},{"command":"invoke","selector":".comment-section .fivestar-widget","method":"removeClass","arguments":["pointer"]},{"command":"css","selector":".comment-section .fivestar-widget div.on:last a","argument":{"width":"100%"}},{"command":"redirect","url":"https:\/\/admin.default.com\/file\/2091\/download?token=OEJk7avE","delay":0,"new_window":false},{"command":"modal_dismiss"}]
and will get error in this line in JS file
xhr.send( ( s.hasContent && s.data ) || null );
So guys if you have any idea about this please help me.And I'm new in this project so I don't know, how to start.. Please help guys. I have attached few images related to issue that will help to understand what the issue is.[Error 1] [Error 2]
Please help guys..!!!
I'm trying to assert that there is no mixed content in a website. I have set the log level equal to 1 in the chrome switches , but i m still unable to retrieve warning messages from the browser, here is the code im using.
browser = Watir::Browser.new :chrome,
switches: %w[--disable-gpu --no-sandbox
--disable-prompt-on-repost
--windows-size=3200x1800
--log-level=1]
console_log = browser.driver.manage.logs.get (:browser)
What am i doing wrong? or there is other way to set this log level to capture errors and warnings?
Work done ,, just changing the way i was passing the settings to the browsr is working
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--disable-infobars')
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
options.add_argument('--disable-prompt-on-repost')
options.add_argument('--user-agent="Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G925F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36"')
The code below works fine in HtmlUnit 2.27, but the setUserAgent method is not available in 2.28 what is the correct way of setting the useragent now?
BrowserVersion bv = BrowserVersion.CHROME;
bv.setUserAgent(
"Mozilla/5.0 (Linux; Android 6.0; XT1063 Build/MPBS24.65-34-4; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36");
Starting with 2.28 it is no longer possible to modify the build in browser versions. There are various reasons for this and we had some discussions about possible fixes on our mailing lists.
In the end we are using a factory pattern to setup new browser configurations and make them unchangeable afterwards.
final BrowserVersionBuilder myChromeBuilder = new BrowserVersion.BrowserVersionBuilder(BrowserVersion.CHROME);
// do your setup here
myChromeBuilder.setXXX(..);
final BrowserVersion myChrome = myChromeBuilder.build();
If you like you can also use a more fluent style for the code
final BrowserVersion myChrome = new BrowserVersion.BrowserVersionBuilder(BrowserVersion.CHROME)
// do your setup here
.setXXX(..)
.build();
In my project, I want to get the PC name of the client user
but the methods I am using just give me the PC name of the server:
System.get(user.name)
Sorry you can't directly
Your best bet is User-Agent header. You can get it like this in JSP or Servlet,
String userAgent = request.getHeader("User-Agent");
The header looks like this,
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.13) Gecko/2009073021 Firefox/3.0.13
It provides detailed information on browser. However, it's pretty much free format so it's very hard to decipher every single one. You just need to figure out which browsers you will support and write parser for each one. When you try to identify the version of browser, always check newer version first. For example, IE6 user-agent may contain IE5 for backward compatibility. If you check IE5 first, IE6 will be categorized as IE5 also.
You can get a full list of all user-agent values from this web site,
http://www.user-agents.org/
With User-Agent, you can tell the exact version of the browser. You can get a pretty good idea on OS but you may not be able to distinguish between different versions of the same OS, for example, Windows NT and 2000 may use same User-Agent.
Remember the scope the client could be behind a proxy
A smart idea is to use javascript and send infos via ajax call
Browser, Operating System, Screen Colors, Screen Resolution, Flash version, and Java Support should all be detectable from JavaScript (and maybe a few more). However, computer name is not possible across all browser at least.
You can do it with IE 'sometimes' as I have done this for an internal application on an intranet which is IE only. Try the following:
function GetComputerName()
{
try
{
var network = new ActiveXObject('WScript.Network');
// Show a pop up if it works
alert(network.computerName);
}
catch (e) { }
}
I am using selenium-webdriver and running this test on a remote machine.
I want to redirect the user to the mobile website by changing the user agent.
I tried with the following, but it doesn't work.
require 'selenium-webdriver'
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => 'Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10')
browser = Selenium::WebDriver.for :remote, :desired_capabilities => capabilities
browser.get "http://mobile.website.com/"
I am getting this error on my browser
Selenium::WebDriver::Error::WebDriverError (Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=):
a. Is there any way to achieve this without using selenium?
b. Is there any way to detect the user's browser and redirect the user to URL with the mobile user agent string(iphone,android)?
Why not test your website in a real mobile device, e.g. using Appium.
You can use Appium to drive the browser in your mobile.