WDIO Unable to pass value using setValue/keys function to the pin locator WebElement - setvalue

When I try to login to "https://portal.flipdish.com/login/pin" website using the userID ="did#gmail.com" , I am unable to pass the pin value to the pin locator.
Pin locator should accept 6 digit numeric value 0-9
I have used getter for fetching the xpath
get inputPin() {
return $('//input[#data-fd="pin_input"]');}
and tried below ways to pass the value but pin web-element not accepting
await browser.execute(function () {
document.querySelector("#pin_code_input").value=158749
});
await this.inputPin.setValueEnhanced("123456");
Browser.keys function as well
Can anyone help me with this to pass values to this locator. I have pasted the HTML snippet for the same.
enter image description here

Related

Saving Icon variable or color variable to firebase and using it

I would like to save flutter variables to firebase as string "Colors.black" and use it in my code as color: document.data()['color'] however, I keep getting the following error type 'String' is not a subtype of type 'Color?'
That's why I am asking how to save various variable types to firebase as strings and use them in flutter code as the types (Icon or Color).
A string and a variable are two different language tokens. I don't think there's a way you could convert a string to use it as a variable name directly considering the fact that there's also a case needed to be handled when the string is not a valid name in your program.
However you would make sure that you only save the correct variable names in the database, the compiler/analyzer wouldn't understand that. So first, you need to add a middle abstract layer (for example, a proxy to an object in JS or just a function) and pattern match or switch-case the string to get the variable you need.
Here's how you can do it with a plain old function.
// Assuming you're working with Flutter
import 'package:flutter/material.dart' show Colors, Color;
Color getColorByName(String name) {
switch (name) {
case "black":
return Colors.black;
// default is for when the name is not recognized
default:
return Colors.transparent;
}
}
void main() {
const data = {"color": "black"};
// --- ^ suppose data from db
print(getColorByName(data["color"]));
}
I found the solution for Icons here: Dynamic Icons in Flutter
This is it:
Text('Add_Icon_String_Here', style: TextStyle(fontFamily: 'MaterialIcons', color: Colors.white, fontSize: 50))
All you have to do is change Add_Icon_String_Here to your icon string eg add_ic_call
Notes:
You can save the icon in firebase as a string like so: add_ic_call you don't need to add the Icons. prefix,
Make sure the icon exists, this way you can prevent errors. You could check here first: api.flutter.dev/flutter/material/Icons-class.html

Flutter : How to add element to map field inside firebase database?

I'm trying to find a way to add element to map field inside firebase database from my flutter code. The element as well is a map. So it's a nested map.
Future updateImageDate({
String token,
int rating,
int like,
int display_count,
//Map participants,
}) async {
return await pictureCollection.document(token).updateData({
'rating': rating,
'like': like,
'display_count': display_count,
//'participants': participants,
// I want to add only one element to this existing map field in firebase database.
// Although currently it's empty, I want to keep add new element every time I use this method.
// The element as well is a map. So it's a nested map.
});
}
Please help me! I'm looking forward to hearing from you. Thank you in advance. :D
To write to a map, use dot (.) notation. So:
pictureCollection.document(token).updateData({ 'path.to.field': 'new value' });

How to extract params from received link in react native firebase dynamiclink?

I tried to migrate from react navigation deeplinks to firebase dynamic linking using this library (react-native-firebase).
I have set up everthing and links are being generated and received on the app. However, is there any way to extract the params sent in the link properly using this library?. Currenty this is my code for handling received link:
handleDynamicLink = () => {
firebase
.links()
.getInitialLink()
.then((url) => {
console.tron.log('link is ', url);
})
.catch((error) => {
console.tron.log(error);
});
};
The url received is
https://links.dev.customdomain.in/?link=products%2F1122
I want to extract the product id 1122 from the url. The only way for me right now is to parse the string and manually extract the relevant params. Unlike in react navigation deeplinks where I used to specify the path, like
Product: {
screen: Product,
path: 'customdomain/products/:slug',
},
Where the slug or id data used to pass as navigation param in the respective screen. Am I missing something? How can I pass mutliple params this way?
Point 2 in this link here says:
The response contains the URL string only.
This means that the firebase.links().getInitialLink() method does not return query parameters, at least as at the time of writing this (v5.5.5). To add your paramaters, you should use a URL with your query param as part of the URL. What I mean is this
Use https://links.dev.customdomain.in/link/products/1122
and use Regex to extract the product id which is of interest to you. This is what works for me and I hope it helps.

IBM Watson conversion for dialog

I created one project with watson conversion.
Flow is like:(sorry i can't show my dialog flow but i will try to explain it)
(W:Watson,U:User)
U:what documents required for open account?
W: Name, Email, Contact. Can I open it for you?
U:Yes
W:Great, Please enter your Name.
U: XYZ
W: XYZ please enter your contact number.
U: 9999999999
W: XYZ, you are doing great please enter your email.
U: xyz#domain.com
now come to watson dialog part.
W:Great, Please enter your name.(i used " < ? input.text ?>" to take user input)
{
"context":{"name":"< ? input.text ?>"}
"output":{"text":"Great,Please enter your name."}
}
U:XYZ
W:XYZ please enter your contact number
{
"context":{"contact":"< ? input.text ?>"}
"output":{"text":"$name, Please enter your contact number"}
}
U:9999999999
W: XYZ, you are doing great please enter your email.
{
"context":{"email":"< ? input.text ?>"}
"output":{"text":"$name, you are doing great please enter your email."}
}
U: xyz#domain.com
This is my flow and it is working perfect when I run it inside the watson.
But when i am trying to run it from my own application then it takes only my name but not entered in loop means it is not taking other information.
reason is in json it pass:
{
"text":"XYZ"
}
but watson shows it's intent as irrelevant.
in my project i just want to pass user data from my application to watson and it display output as mention above.
is it support < ? input.text ?>...?
For the part where Watson Conversation is giving intent as irrelevant, it is so because you be missing to send parameter conversation_id as context parameter.
You will get conversation_id in response and pass it in subsequest calls. If you do not pass that, then a new id will be generated everytime
//Extract converstaionId from first call
String conversationId=msgResponse.getContext().get("conversation_id")
//Second call in which user gives his name
Map contextData=new HashMap();
context.put("conversation_id", conversationId); // conversationId will be in the response of previous call

How to Perform Search Operation on Value in Firebase? AngularJS

Say example, I have 4 users with email addresses:
hello#world.com
hi#world.com
yo#world.com
yeah#world.com
This is my search query from view
$scope.searchQuery = "h";
I run this query which allows me to get a list of user with the email address that start with letter "h".
usersRef.orderByChild('email').startAt($scope.searchQuery).endAt($scope.searchQuery+"~").on('value', function(snapshot){
console.log(snapshot.val());
}
So, the results in here are:
hello#world.com
hi#world.com
However, I'd like the searchQuery to match the whole string, not just the start with letters.
The expected results in this case are ($searchQuery = "h"):
hello#world.com
hi#world.com
yeah#world.com
I've tried this:
usersRef.orderByChild('email').startAt($scope.searchQuery).endAt("~"+$scope.searchQuery+"~").on('value', function(snapshot){
console.log(snapshot.val());
}
The results includes all 4 email addresses.
Then, I've tried this:
usersRef.orderByChild('email').startAt("~"+$scope.searchQuery).endAt($scope.searchQuery+"~").on('value', function(snapshot){
console.log(snapshot.val());
}
The result was null.
Can someone help me to figure this out please.
Any answer would be appreciated.
Thanks

Resources