I need to pass values from excel sheet ( stored in variable api ) to XPATH in eclipse (java - Selenium).
I tried several options but none works. Please guide.
Here is my line of code.
String appcode = //input[contains(#id,'app') and contains(#type,'text') and ancestor::div[contains(#id, '+api+')]]
When i hardcode the value of api as below it works.
String appcode="//input[contains(#id,'app') and contains(#type,'text') and ancestor::div[contains(#id, 'setmember')]]";
Isnt it this easy?
Appreciate your help
pk
you probably did not end the String constructor properly. Try this:
String appcode = "//input[contains(#id,'app') and contains(#type,'text') and ancestor::div[contains(#id, '" +api+" ')]]";
My assumption is, that api variable is type String
you can use \" so you would have something like
String appcode ="//input[contains(#id,\" "+[VARIABLE]+ " \")[..] ";
Related
I want to create a new map every time the button is pressed.
I want the names of the maps to be regular.
I tried using ${} in the map name but it doesn't seem to work.
is there any solution?
You may think you want this, but you don't. Information and meta-information should remain separate. Very likely, a Map of Maps will accomplish everything you want with dynamic names.
There are a few ways to do this:
Use the sprintf function:
String mapName = sprintf("map_%d", mapNumber);
Use string interpolation:
String mapName = "map_${mapNumber}";
Use a template string:
String mapName = map_${mapNumber};
I have two Visualforce pages, and for several reasons I've decided it is best to pass a datetime value between them as a string. However, after my implementation my date always appear to be null even though my code seems to compile.
I have researched quite a few formatting topics but unfortunately each variation of the format() on date time seems to not produce different results.
The controller on page 1 declares two public variables
public datetime qcdate;
public String fdt;
qcdate is generated from a SOQL query.
wo = [SELECT id, WorkOrderNumber, Quality_Control_Timestamp__c FROM WorkOrder WHERE id=:woid];
qcdate = wo.Quality_Control_Timestamp__c;
fdt is then generated from a method
fdt = getMyFormattedDate(qcdate);
which looks like this
public String getMyFormattedDate(datetime dt){
return dt.format(); }
fdt is then passed in the URL to my next VF page.
String url = '/apex/workordermaintenanceinvoice?tenlan='+tenlan +'&woid=' + woid + '&invnum=' + invnum + '&addr1=' + addr1 + 'fdt=' + fdt;
PageReference pr = new PageReference(url);
I expected when calling {!fdt} on my next page to get a proper string. But I do not.
UPDATE:
Sorry I guess I should not have assumed that it was taken for granted that the passed variable was called correctly. Once the variable is passed the following happens:
The new page controller creates the variable:
public String fdt
The variable is captured with a getparameters().
fdt = apexpages.currentPage().getparameters().get('fdt');
The getfdt() method is created
public String getfdt(){
return fdt;
}
Which is then called on the VF page
{!fdt}
This all of course still yields a 'blank' date which is the mystery I'm still trying to solve.
You passed it via URL, cool. But... so what? Page params don't get magically parsed into class variables on the target page. Like if you have a record-specific page and you know in the url there's /apex/SomePage?id=001.... - that doesn't automatically mean your VF page will have anything in {!id} or that your apex controller (if there's any) will have id class variable. The only "magic" thing you get in apex is the standard controller and hopefully it'll have something in sc.getId() but that's it.
In fact it'd be very stupid and dangerous. Imagine code like Integer integer = 5, that'd be fun to debug, in next line you type "integer" and what would that be, the type or variable? Having a variable named "id" would be bad idea too.
If you want to access the fdt URL param in target page in pure Visualforce, something like {!$CurrentPage.parameters.fdt} should work OK. If you need it in Apex - you'll have to parse it out of the URL. Similar thing, ApexPages.currentPage() and then call getParameters() on it.
(Similarly it's cleaner to set parameters that way too, not hand-crafting the URL and "&" signs manually. If you do it manual you theoretically should escape special characters... Let apex do it for you.
I am trying to bind dynamic variable in PySpark selectExpr.
Code:
name = "random_string"
df.selectExpr("variable_name as $name")
And this throws error.
Thanks.
Use standard string formatting:
df.selectExpr(f"variable_name as {name}")
in Python 3.6 or later, or
df.selectExpr("variable_name as {}".format(name))
before.
I tried
df.selectExpr(f"variable_name as " + name)
and it is working.
How do you use Intuit.Ipp.Data.Qbo.CustomerQuery to query a name like:
Tom & Jerry's
This case has 2 special characters that are causing the query to fail. One being & and the other being '. I've tried to use Uri.EscapeDataString and it doesn't work. Any advice?
The SDK does not encode the ampersand correctly, so you will need to use DevDefined and deserialize the response with the SDK. Code sample: https://gist.github.com/IntuitDeveloperRelations/6024616
you would need to xml encode the string.
thanks
Jarred
I know this has been asked earlier.
Most of the answers were not relevant.
Google, shows that the solution is to configure the expression in the "data flow task" and set the query.
However in the ADO .NET source, when I try to preview the output I keep getting "Must declare the variable '#'"
It does not show the full variable in this error - "#[User::GLOBAL_PARAMETER]"
I think that's because "[USER::" isn't the correct syntax inside a SQL; but then how does one set it ?!
From your description it seems like you are having an error due to using the variable name inside the query string as opposed to the processed variable value. In other words:
"SELECT * FROM #[User::TABLE]" in the expression builder would be WRONG
"SELECT * FROM " + #[User::TABLE] would be CORRECT
It would help if you shared the expression you are using as a query