FileUploadDialogHandler() - automation

I am trying to automate a web app which involves selecting an existing file using a fileuploaddialoghandler() method and entering the full path in the file name dropdown then Open click.
However, when I attempt this using this code
FileUploadDialogHandler fileupload = new FileUploadDialogHandler(#"C:\TIFFiles\Testtif.TIF");
//browser.WaitForComplete();
using (new UseDialogOnce(browser.DialogWatcher, fileupload))
{
newIee.Button(Find.ById("ctl00_WebPartManager1_FileUpload_FileBrowse")).ClickNoWait();
browser.AddDialogHandler(fileupload);
browser.WaitForComplete();
browser.RemoveDialogHandler(fileupload);
}
It does not work.
What else should I be doing?
Thanks much!
W

I just have one question about your code... What is newIee? I can't tell by looking at the code if newIee is attached to browser. Other than that, your FileUpdateDialogHandler should be fine.
If you can provide the code where you declare newIee, it might add me in determining if it's a factor causing your code not to work properly.

Related

ZeroBrane : Register APIs on a per file basis

I'm writing a ZeroBrane Studio plugin for our Solarus Game Engine and It works like a charm. Autocompletion included.
I'm wondering now if it's do-able to register lua APIs for one file only.
I need this to offer autocompletion/documentation on global symbols that may vary per-script but are deducible from annex files from the engine.
To summary : Is it possible to register an api for a single file? For example in the onEditorLoad() event.
Thanks.
Greg
EDIT:
I tried the following without sucess:
local function switch_editor(editor)
if current_editor == editor then
ide:Print("same editor")
return
end
current_editor = editor
if not editor then
ide:Print("null ed")
return
end
lua_file_path = ide:GetDocument(editor).filePath
if lua_file_path:match('/data/maps/') then
ide:Print("map file!",type(editor))
local map_api = make_map_api(lua_file_path)
current_api = map_api
ide:AddAPI('lua','solarus_map',map_api)
else
ide:Print('other file')
if current_api then
ide:RemoveAPI('lua','solarus_map')
current_api = nil
end
end
end
api = {"baselib", "solarus", "solarus_map"}, --in interpreter table
... -- in the plugin table :
onEditorFocusSet = function(self,editor)
switch_editor(editor)
end,
Completion with the solarus api works fine but the on-fly registration of the solarus_map api seem not to be taken in account.
EDIT2:
Silly my, I must have done a typo, because after checking and rewriting some things pretty much as in the code pasted above... it works! Awesome!
The only small gotcha is that when switching to a file where I don't want the solarus_map API... ide:RemoveAPI isn't sufficient. Instead I must do ide:AddAPI('lua','solarus_map',{}) to replace the API with an empty one. Which I can live with.
To summary, to achieve a custom api which change from file to file:
Add the api name to the interpreter
In the onEditorFocusSet event, update the API with ide:AddAPI(...), eventually setting it to {} if it needs to be empty/disabled.
Code sample in the editions of my Question.

Visual Studio Code change my html code by itself and break all

Someone know the solution for this:
I have a simple Angular code inside Visual Studio Code and every time i save a file a fragment is changed by itself.
It: <app-mytag [myVarHere]="myVarHere"></app-mytag>
becomes it: <app-mytag></app-mytag>
by the simple act of save the file.
Im using nano editor outside to solve it.
Its my plugin list:
1tontech.angular-material
4tron.angular-material-snippets
Angular.ng-template
AngularDoc.angulardoc-vscode
EditorConfig.EditorConfig
GregorBiswanger.json2ts
HookyQR.beautify
MarinhoBrandao.Angular2Tests
NG-42.ng-fortytwo-vscode-extension
SimonTest.simontest
UVBrain.Angular2
abusaidm.html-snippets
anweber.vscode-tidyhtml
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
dbaeumer.vscode-eslint
eg2.tslint
eg2.vscode-npm-script
esbenp.prettier-vscode
felixfbecker.php-debug
felixfbecker.php-intellisense
felixfbecker.php-pack
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
jasonnutter.search-node-modules
johnpapa.Angular2
loiane.angular-extension-pack
ms-vscode.autorest
ms-vscode.cpptools
ms-vscode.typescript-javascript-grammar
msjsdiag.debugger-for-chrome
pkosta2006.rxjs-snippets
robertohuertasm.vscode-icons
steoates.autoimport
vuhrmeister.vscode-meteor
waderyan.nodejs-extension-pack
xabikos.JavaScriptSnippets
I think the culprit is anweber.vscode-tidyhtml plugin you are using. The reason why you lose the angular annotations is that, you have enabled tidyHtml.formatOnSave to true
You can disable the plugin or try removing tidyHtml.formatOnSave from your user settings by going in to:
Ctrl + F1 and type user settings
PS - I tried to recreate your problem and here's what happens:

Automatic download of created file in Sencha Touch 2

My Sencha Touch 2 application has an 'Export' button, which creates an Excel file with the data of the selected offer.
After the user clicks the button, i want the (server side) export process to be started, and, once completed, the user to be prompted to select a filename and location, OR that the file is automatically downloaded. How do i do that? Does anyone have an example?
For Excel specifically I'm not 100% sure, but this might help you get started or if a CSV is acceptable...
I'm sure you could pass the file reference to a var instead of the string but I have yet to try it.
If you paste the js below into the console you can see how this works. Pretty basic. Maybe try the returned value from the server to see if that works then if it does you can build a function around it to happen when needed.
csvHeading = 'HA, HB, HC, HD \n';
csvData = 'r3a, r3b, r3c, r3d \n' +
'r2a, r2b, r2c, r2d';
CSVFile = csvHeading + csvData;
window.location = 'data:text/csv;charset=utf8,' + encodeURIComponent(CSVFile);

The selenium got the different html source from my local pc

I fetched http://book.flypeach.com/default.aspx?ao=B2CZHTW&ori=TPE&des=KIX&dep=2015-06-12-undefined-undefined&adt=1&chd=0&inf=0&langculture=zh-TW&bLFF=false by driver.current_url
However I got timeout error by this code
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { #driver.find_element(:css => "div.WrapperFlightDate") }
But I can see the css attributes div.WrapperFlightDate was truly exsiting in the page_source,
How could it happen ?
When I opened given link and trying to see given class in source code(ctrl + u),I didn't find given class.May be page was not loaded properly.
I refreshed page and right click on page -> View Page Source option then got this class in source code.Even I also ran this successfully in FF.
I also surprised why I didn't see correct source code first time.
You also try same,hope so you also get correct code now :).

File download control - delete file without validation?

Hello XPages programmers.
I work on a simple XPages File Library.
To achieve that i use FileUpload control with FileDownload control.
When i create a new file, i enter its name, and select a file.
I set that uploading a file won't activate a validation, so i can attach a file without a specified name. Additionally i set it to do fullrefresh, so uploading a file takes place in an instant and a file is visible in FileDownload control.
Problem occurs, when i want to delete that attachment using garbage icon of FileDownload - i can't set it to run without walidation.
Is there any workaround avaiable?
Any help will be appreciated.
I used the workaround Mark Leusink suggested - created a simmilar button (used image from filedownload control) and then set it for full refresh with process data without validation property.
Code in JSSS
function deleteAttachments()
{
var attList = dDocument.getAttachmentList("Document_Attachment");
for(var i=0; i<attList.size(); i++)
{
var att:String = attList[i];
dDocument.removeAttachment("Document_Attachment", att.getName() );
}
}
Surely it can be used for delete a specific attachment by getting attachment name from rowdata in a repeater and use DATASOURCE.removeAttachment method.
Thanks for your support!