I want to retrive data one by one in java applet in HTML using watin but I doesn't find these records.Actul scenario is http://i.stack.imgur.com/984Ry.png .
Page Source is following but I want to read record like http://i.stack.imgur.com/984Ry.png
< applet name="view" code="lotus.notes.apps.viewapplet.ViewApplet.class" codebase="/domjava" archive="nvapplet.jar" alt="View" width="100%" height="100%" mayscript >
< param name="cabbase" value="nvapplet.cab" >
< param name="Database" value="repairnet/ConConnect.nsf" >
< param name="ViewName" value="Web Views\Open Claims" >
< param name="PanelStyle" value="LINE_BORDER" >
< param name="ViewUNID" value="03CE72869B6C38E080257670003A0721" >
< param name="ShowSelectionMargin" value="FALSE" >
< param name="Expand" value="TRUE" >
< param name="bgColor" value="#FFFFFF" >
< param name="RestrictToCategory" value="Marshgate%20Builders%20Ltd" >
< param name="locale" value="en-us,en" >
< param name="IconPath" value="/icons" >
< /applet >
Please help me.
WatiN is only able to read html/the DOM. Your data seems to be inside the java applet, which WatiN can't read.
Using the browser console, anything you can do there can be done with WatiN using the browser eval method. In your case, if you can run
$("applet[name='view']").innerHtml
from the browser's console (inspect element console), you should be able to add this line to the WatiN test. Just make sure you backslash out any of the quotes inside of your eval as I have done.
string params = Browser.Eval("$(\"applet[name='view']\").innerHtml")
From there, you could parse the params and iterate through each name/value line in the string.
Alternatively, if inspect element shows the applet inline with the rest of the html (perhaps in the < head >), you should be able to grab it via the page class element getters. From there, you can still interact with it.
[FindBy(Name = 'view')]
public Element myApplet { get; set; }
Search WatiN's documentation on page classes for more info on that.
Related
Suppose I’ve a running action that generates a list of dynamic buttons to the user. Generally, the button inputted from the user is going to NLU. But I want to know which button the user just picked and act accordingly in this running action. For example, If the user chose “Toyota” I want to call another action from this running action. All I want is not to go to NLU and not to check there. I want everything in my running action. Is it possible? If so, can someone provide the way I can approach?
My action class is given below.
> class ActionVehicleManufacture(Action):
> def name(self):
> return "action_vehicle_manufacturer"
>
> def run(self, dispatcher: CollectingDispatcher,
> tracker: Tracker,
> domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
>
> r = requests.get('http://mind.zantrik.com/api/A1/GetVehicleManufacturer')
> response = r.text
> json_data = json.loads(response)
> l = []
> buttons = []
> for i in json_data["data"]:
> l.append(i["manufacturerName"])
> for i in l:
> buttons.append({"title": i, "payload": i})
>
> dispatcher.utter_message(text="Please let me know you car manufacturer name:", buttons=buttons)
> # I want to apply some condition here according to users inputted button.
> return []
To call an action after a new user message (e.g, selection of a button or free text) you need to include a story in you storied.md. Which action is arbitrary. For example:
## story example
* ask_about_manufacturers
- action_vehicle_manufacturer
* inform{"manufacturer": "toyota"}
- action_execute
If you have defined manufacturer as a slot, the type of the slot influences the stories. If you have seen Slots Set By Clicking Buttons, to set the slot manufacturer you need to do instead of
buttons.append({"title": i, "payload": i})
the following, where intent is the intent that captures the message "toyota", in the story example above "inform".
buttons.append({"title": i, "payload": f"""/{intent}{{"manufacturer": "i"}}""")
I'm trying to use the Behavior and JavaScript FileReader as can be seen in this question: Wicket Drag and drop functionality for adding an image
If I post more than 200k, I get an error Form too large. So perhaps I am missing some multipart stuff.
What is the proper way to call Wicket.ajax.post() with a large amount of data?
I tried setting mp to true, but then it started complaining that I do not have a form id. Does it need a form?
Btw. I use Jetty, but that has no problems using a regular file upload using forms.
This error comes from jetty Request implementation.
If you look at sources of the Request#extractFormParameters method, you will see next:
if (_context != null)
{
maxFormContentSize = _context.getContextHandler().getMaxFormContentSize();
maxFormKeys = _context.getContextHandler().getMaxFormKeys();
}
if (maxFormContentSize < 0)
{
Object obj = _channel.getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize");
if (obj == null)
maxFormContentSize = 200000;
else if
...
}
So, in fact, you can really set your context values as pikand proposed as 0, or set server config as follows:
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
<Arg>-1<!-- or 0, or any lt 0 --></Arg>
</Call>
...
</Configure>
Your exception is thrown a bit later according to this code:
if (contentLength > maxFormContentSize && maxFormContentSize > 0)
{
throw new IllegalStateException("Form too large: " + contentLength + " > " + maxFormContentSize);
}
So, you can see, that maxFormContentSize could be <= 0 not to throw this exception.
I think, there is no need to update something via ajax. But in fact it is better to limit data size, not to allow users put down your server.
Other application servers have their own settings, for most of them you should set maxPostSize value to zero, to disable this restriction.
Also, wicket Form component has it's own maxSize property, you can set it with Form#setMaxSize. The problem is that Form transmittes this value as Bytes value to FileUploadBase class, which has next javadoc:
The maximum size permitted for the complete request, as opposed to
fileSizeMax. A value of -1 indicates no maximum.
And actually this parameter is set via fileUpload.setSizeMax(maxSize.bytes());, and Bytes can't hold negative value. But I think you can try to set it as 0 and check if it works. By default, Form#getSizeMax() method checks:
return getApplication().getApplicationSettings().getDefaultMaximumUploadSize();
Which returns Bytes.MAX, which is equals to 8388608 terabytes. I think, this is about to be "no limit" value :)
Additionaly, as I know - you don't need to set Form id, to allow using multipart parameter. Only if you updating your form via ajax, you have to set Form.setOutputMarkupId(true). But actually, Form creates id by itself in renderHead method if it is multipart:
// register some metadata so we can later properly handle multipart ajax posts for
// embedded forms
registerJavaScriptNamespaces(response);
response
.render(JavaScriptHeaderItem.forScript("Wicket.Forms[\"" + getMarkupId()
+ "\"]={multipart:true};", Form.class.getName() + '.' + getMarkupId()
+ ".metadata"));
Note, that getMarkupId() method creates markup id if does not exists.
There is a form size limit in Jetty defaulting to 200k.
Add a jetty-web.xml in your webapp/WEB-INF folder. There you can set a form size limit of the needed size.
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure id="WebAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="maxFormContentSize" type="int">900000</Set>
<Set name="maxFormKeys">5000</Set>
</Configure>
I am trying to interact with an external website at: http://is.gd/LtgYEk
I need to be able to fill in the input with id="textOrigen" here is the html
<p>
<label class="form-label">Departing from:</label>
<span class="label-field">
<input type="text" autocomplete="off" onblur="onblur2('textOrigen');" onfocus="initID('textOrigen');" size="17" id="textOrigen" name="text" maxlength="40" style="position:static;color: #505050;">
<select style="display:none" onchange="clearValidate(); Origen();" class="validate[dynamic]" id="cmbOrigen" name="cmbOrigen">
<option value="-1" selected="selected">Origin</option>
</select>
<label class="label-error" id="lblerrorOrigen"></label>
</span>
</p>
I put together a simple ruby script using 'capybara/poltergeist'
I am unable to replicate the browser behavior, which is:
on click the input field default value is highlighted thus being deleted as you start typing.
I lost track of all different variations I tried, but tried many. I found another SO post which seemed somewhat useful but it didn't help
This is the last revision of the method to fill this field:
def session.fill_autocomplete(field, options = {})
execute_script %Q{ $('##{field}').trigger('focus') }
fill_in field, with: options[:with]
execute_script %Q{ $('##{field}').trigger('focus') }
execute_script %Q{ $('##{field}').trigger('keydown') }
selector = %Q{#output div:contains('#{options[:with]}')}
execute_script "$(\"#{selector}\").mouseenter().click()"
end
As I wrote the script is very simple, the only other relevant bit is when the session is instantiated with:
session = Capybara::Session.new(:poltergeist)
Any help would be greatly appreciated.
I noticed that using the right version of phantomjs is fundamental.
Although 2.x is out, I noticed that phantomjs 1.8.2 behaves much more as expected and is way less buggy.
I'm currently testing autocompleted fields in RailsAdmin with success without using any delay technique.
def fill_in_autocomplete(selector, text)
find(selector).native.send_keys(*text.chars)
end
def choose_autocomplete_entry(text)
find('ul.ui-autocomplete').should have_content(text)
page.execute_script("$('.ui-menu-item:contains(\"#{text}\")').find('a').trigger('mouseenter').click()")
end
An example selector for fill_in_autocomplete would be:
".author_field .ui-autocomplete-input"
I found the solution after testing in many ways.
The key was to add some delay to allow the auto suggest div to be populated.
Here is the method that worked:
def session.fill_city(field, options = {})
sleep 3
script = %Q{ $("#{field}").focus().keypress().val("#{options[:with]}") }
execute_script(script)
sleep 2
find('#output').find('div').trigger('click')
end
I'm using Windows Indexing search together with PHP to search inside thousands of files.
I got it working by using the PHP COM class:
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$recordset = new COM("ADODB.Recordset");
$conn - > Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");
$recordset - > Open("SELECT System.ItemName, System.DateModified FROM SYSTEMINDEX WHERE DIRECTORY='file:C:/xxxx/' AND CONTAINS('xxxx')", $conn);
$recordset - > MoveFirst();
while (!$recordset - > EOF) {
echo $recordset - > Fields - > Item("System.ItemName") - > Value."\n";
$recordset - > MoveNext();
}
I am retrieving the DateModified field of each element and I've realized the format of it depends on the System configuration. It is possible to set it through the control panel in Windows.
I am wondering if there's any way to get it in the desired format in order to avoid having to change it by using the control panel in every system I want to run the script.
I noticed the object has the property formatAs but I'm not sure how to change it and the documentation is not very complete.
Thanks.
You can convert a VT_DATE object into a UNIX timestamp with variant_date_to_timestamp and then format it with date, this should work regardless of the date format in the control panel.
$format = "Y-m-d";
$object = $recordset->Fields->Item("System.DateModified")->Value;
$timestamp = variant_date_to_timestamp($object);
echo date($format, $timestamp) . "\n";
I am actually generating some xml from haml template, using Padrino Framework.
There are some tags that are self closing.
For that I did add following statement in subapp/app.rb as padrino is based on sinatra
set :haml, :autoclose => %w[meta img link br hr input area param col base else var assign script log submit exit reprompt goto]
But the Result is same for
1. else tag
I get
<else> </else>
but expected is
<else />
Similar to br tag.
Try with in config/boot.rb
require 'haml/template/options'
Haml::Template.options[:autoclose] = %w[meta img link br hr input area param col base else var assign script log submit exit reprompt goto]
It has to be like this, if you're outside of Rails:
require 'haml/template/options'
Haml::Options.defaults[:format] = :xhtml