How to upload multiple files to the page - selenium-webdriver

I am trying to upload multiple files to the page with
<input id="dropInput" type="file" multiple>
For one file it is as simple as:
driver.FindElement(By.Id("dropInput")).SendKeys(#"path-to-file");
As a user I can click Choose Files button and select number of files (with Ctrl) so in Open dialog I can see sth like: "file-1" "file-2"
From the script it does not work. I have tried different combinations of SendKeys argument:
#"file-1" + " " + #"file-2"
#"file-1" + ", " + #"file-2"
"\"path\\to\\file-1\" \"path\\to\\file-2\""
Path.GetFullPath(file-1) + " " + Path.GetFullPath(file-2)
"\"" + Path.GetFullPath(file-1) + "\" \"" + Path.GetFullPath(file-2) + "\""
The input accepts the last file only. The same with sending keys several times. For the last example I have got an exception:
unknown error: path is not absolute: "file-1" "file-2"
I am out of ideas.
I'd like to know if there is any simple solution for that before I'll start injecting jQuery scripts to the page under test.
Please advise.
Cheers,
Przemek

Related

SSIS Custom Column Property

I have a general question I'm hoping someone can answer about creating custom properties for use in a Data Flow Component.
Is it possible to create custom properties for use at the column level? I can create custom properties at the component level, no problem, but that does me no good.
I want to add two properties (Encrypt and Decrypt) to the Input Column metadata.
Say I have a collection of Input columns col1, col2, col3. As a developer, I would like to set col3's Encrypt value to true so, at run time, col3 gets encrypted before being loaded into a database.
I have successfully encrypted and decrypted using a custom component. Still, I used the values "e" and "d" in the column Description and then evaluated that Description during PreExecute. I set a state object based on the value of Description and add it to a collection that is processed during ProcessInput. I don't think using the Description is a good thing to do, and that is the need for the custom properties.
Do SSIS columns have custom properties?
The answer is yes. SSIS columns are objects that inherit the IDTSColumn130 interface. As mentioned in the SSIS documentation, this interface contains a property called CustomPropertyCollection that contains the collection of IDTSCustomProperty100 objects added to the input by the component.
Some components add some custom property to the SSIS columns such as the Derived Column Transformation. As I know, a custom component called FriendlyExpression is used to store the expression in plain text form. But, there is no way to add custom properties in the Integration Services package designer (Visual Studio).
How to add Custom Properties?
I think the only way is to create packages programmatically and edit those values or develop a custom SSIS component that adds these properties at runtime.
This is an example of reading the custom properties of a Derived Column transformation using C#. (Reference)
foreach (IDTSInputColumn localIColumn in localInput.InputColumnCollection)
{
if (localIColumn.CustomPropertyCollection.Count == 2)
{
repository.AddAttribute(componentRepositoryID, localInput.Name + " [" + localIColumn.Name + "] [ID: " + localIColumn.ID.ToString() + "]", "From [" + localIColumn.UpstreamComponentName + "] " + FormatColumnDescription(localIColumn.Name, localIColumn.DataType, localIColumn.Length, localIColumn.Precision, localIColumn.Scale) + " Expression " +
localIColumn.CustomPropertyCollection["FriendlyExpression"].Value != null ? localIColumn.CustomPropertyCollection["FriendlyExpression"].Value.ToString() : "Not Available"
);
}
else
{
repository.AddAttribute(componentRepositoryID, localInput.Name + " [" + localIColumn.Name + "] [ID: " + localIColumn.ID.ToString() + "]", "From [" + localIColumn.UpstreamComponentName + "] " + FormatColumnDescription(localIColumn.Name, localIColumn.DataType, localIColumn.Length, localIColumn.Precision, localIColumn.Scale) + " Expression (See Ouput Column)");
}
//repository.AddObject(localIColumn.Name, "", ColumnEnumerator.ObjectTypes.Column, componentRepositoryID);
}
Alternatives
You can store the columns metadata within an external data source (SQL, XML, ...) and load it at runtime. Or you can use the Description property as you mentioned in your question.

Overwriting zip file in expression with user variable in ssis

I want to overwrite a zip file in a folder but when i tried the below expression, it is giving an error as:
The expression is not valid and could not be parsed. it might contain invalid elements.
Expression:
#[User::Command_Syntax] = " /c copy " + "\"" + #[User::Output_File_Path_Var] + substring(#[User::Output_Zip_Name_Var], 1, len(#[User::Output_Zip_Name_Var]) - 4) + REPLACE(right(#[User::Output_Zip_Name_Var], 4) , ".zip", "") + ".zip" + "\"" + " " + "\"" + #[User::Archive_File_Path_Var] + substring(#[User::Output_Zip_Name_Var], 1, len(#[User::Output_Zip_Name_Var]) - 4) + REPLACE(right(#[User::Output_Zip_Name_Var], 4) , ".zip", "") + ".zip" + "\""
Can any one please let me know why i'm getting error. Thanks in advance!
I use a tool, which is outside of Visual Studio, which helps troubleshoot expression building. The tool information is here: SQLIS | SSIS Expression Editor & Tester and the github is here: SSIS Expression GitHub
That being said, I copy/pasted your expression above into the editor, added in the # user variables with made-up values in the "Add Variable" ability of the tool, and I get this as my output when evaluating.
So it does seem to evaluate for me, could you verify your user variables are spelled correctly and they are the correct type (string)?
You could also verify the variable assignments during debugging. Here is a good article on how to debug, if needed: Debugging Control Flow in SSIS

Write scope within dynamic string

I am working on localization within my angular project. It reads a JSON file which is having key and it's localized value in string.
Like: text1:"Localized text"
This prints "Localized text" on page correctly. But when I need to add some dynamic text in the string, like:
text1: "Showing page {{cur_page_num}} of {{total_pages}} pages"
where the cur_page_num and total_pages values will come from controller. I have tried
"Showing page {{cur_page_num}} of {{total_pages}} pages"
but it's printing {{cur_page_num}} and {{total_pages}} as it is without evaluating it.
use ng-bind-html
EX:
<p ng-bind-html="obj.text1"></p>
At this point you may get an error.
attempting to use an unsafe value in a safe context error
you need to either use ngSanitize or $sce to resolve that.
try storing the json values in an array .
iterate it on html & render it there .
if it is from template then your code should be like this,
text1: "Showing page " + {{cur_page_num}} + " of " + {{total_pages}} + " pages"
or if it is from controller then it can be like below,
text1: "Showing page " + $scope.cur_page_num + " of " + $scope.total_pages + " pages"

Change language in ui.bootstrap.datepicker

I was trying to make the calendar info to be shown in Ukrainian language, so at first I looked through this and hoped that I would just override tha template:
angular.module("uib/template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/datepicker.html",
"<div class=\"uib-datepicker\" ng-switch=\"datepickerMode\" role=\"application\" ng-keydown=\"keydown($event)\">\n" +
" <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" +
" <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" +
" <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" +
"</div>\n" +
"");
}]);
When I found nothing there, I searched in the datepicker.js hoping to find some arrays with the name of months and days that I could override, but I found nothing.I have no idea how to do this, and can't find appropriate solution here. I would be very grateful if you tell me (or show answered question which I couldn't find) how to do this, using minimum hacks and mocks :)
You can add the localized js file to your scripts. This should help you find the correct file.

ssis variable not evaluating

I have a variable that concatenates a file path into a string , and i can't get it to evaluate the concatenation. when i display the value of the variable in a script task, i still see all the double quote marks (see below). I have set the evaluateasexpression for the variable to true.
When i try to use this variable as a sql command, the error is:
"invalid syntax near the +"
(i believe this is the plus sign below the redactedcol3 below)
BTW, is property expressions the only place where you can evaluate a variable's value as you are developing? (expression builder).
This is how the variable displays in the message box in the script component:
"SELECT redactedcol1,redactedcol2,rtrim(" + "'" + #user::LocalPath + " + "'" + "+[redactedcol3]) AS Path FROM dbo.SF_redacted where id=1"
Not entirely sure this is what you want, but I think it is:
"SELECT redactedcol1,redactedcol2,rtrim("
+ "'"
+ #user::LocalPath
+ "'"
+ " + [redactedcol3]) AS Path FROM dbo.SF_redacted where id=1"
Note the removed extraneous plus sign and double-quote. (I find it helps when concatenating in SSIS to put each part on its own line.)
And I also recommend BIDS Helper, a free tool that includes a better (IMO) expression building GUI, as well as Konesans' Expression Editor which is a like a mini-Intellisense workbench for expressions.
There's also a Variables window in SSIS Projects (View -> Other Windows -> Variables) where you can see the evaluated value of a variable expression.
For others wondering why their expression is not evaluating...
http://www.sqlchicken.com/2012/02/ssis-expressions-not-evaluating-correctly/
Click on the Variable. Make sure "EvaluateAsExpression" is True

Resources