how to select few words from text area in selenium rc - selenium-rc

steps:
1. i uploaded file using browse option.
2. uploaded file content displayed in non-editable format
3. now i have to select few words.
for this i used mouseMoveAt (100,200) mouseDown() mouseMoveAt (150,250) mouseMoveUp().
This is not working..
Can anyone can give sample code?

I'm not sure I understand your question completely, but here's my take -
You can use selenium.getText(); for retrieving the text on a page and storing it in a variable. You can use this variable, which you can verify for correctness.
Here's an example syntax:
String var = selenium.getText(your_identifier_for_text);
Further, if you need to extract and verify just a portion of the text contained in var, you can use Java string functions.

Related

How to properly scraping filtered content using XPath Query to Google Sheet?

So, this is about a content from a website which I want to get and put it in my Google Sheets, but I'm having difficulty understanding the class of the content.
target link: https://www.cnbc.com/quotes/?symbol=XAU=
This number is what I want to get from. Picture 1: The part which i want to scrape
And this is what the code looks like in inspector. Picture 2: The code shown in inspector
The target is inside a span attribute but the span attribute looks very difficult to me, so I tried to simplify it using this line of code here =IMPORTXML("https://www.cnbc.com/quotes/?symbol=XAU=","//table[#class='quote-horizontal regular']//tr/td/span")
Picture 3: List is shown when putting the code
After some tries, I am able to get the right target, but it confuse me, Im using this code =IMPORTXML("https://www.cnbc.com/quotes/?symbol=XAU=","//table[#class='quote-horizontal regular']//tr/td/span[#class='last original'][1]")
Picture 4: The right target is shown when the xpath query is more specified
As what you can see in 2nd Picture, 'last original' is not really the full name of the class, when I put the 'last original ng-binding' instead it gave me an error saying imported content is empty
So, correct me if my code is wrong, or accidental worked out somehow because there's another correct way?
How about this answer?
Modified formula 1:
When the name of class is last original and last original ng-binding, how about the following xpath and formula?
=IMPORTXML(A1,"//span[contains(#class,'last original')][1]")
In this case, the URL of https://www.cnbc.com/quotes/?symbol=XAU= is put in the cell "A1".
In this case, //span[contains(#class,'last original')][1] is used as the xpath. The value of span that the name of class includes last original is retrieved. So last original and last original ng-binding can be used.
Modified formula2:
As other xpath, how about the following xpath and formula?
=IMPORTXML(A1,"//meta[#itemprop='price']/#content")
It seems that the value is included in the metadata. So this sample retrieves the value from the metadata.
Reference:
IMPORTXML
To complete #Tanaike's answer, two alternatives :
=IMPORTXML(B2;"//span[#class='year high']")
"Year high" seems always equal to the current stock index value.
Or, with value retrieved from the script element :
=IMPORTXML(B2;"substring-before(substring-after(//script[contains(.,'modApi')],'""last\"":\""'),'\')")
Note : since I'm based in Europe, you need to replace ; with , in the formulas.

How to format a value to text in BI publisher

I am trying to create a report in BI. I have created a data model using a sql script and the data type is string. I then created a report using this data model and the sample data is showing as 06185 as shown below.
But when i run the report the output is showing as 6185.0 with decimal places.
I have tried to change the format by double clicking the value. But I cant choose any format except none in the report designer. What I need is the values to be displayed same as the sample data.
06185 is not a number - it's a string. As a number you will never have leading 0s. 6185 is a number.
So first of all you need to find out what your data is really supposed to be. "06185" = string. 6185 = integer. 6185.0 = double.
To be quick simply add ' character next to the number character... Else excel will make your life difficult specially if you have bank account numbers...
SELECT payees.supplier_site_id csupplier_site_id,
payees.org_id c_org_id,
payees.payee_party_id ,
cbbv.bank_name,
max(''''||to_char(ieb.bank_account_num)) as bank_account_num
FROM apps.iby_pmt_instr_uses_all instrument,
apps.iby_account_owners owners,
apps.iby_external_payees_all payees,
apps.iby_ext_bank_accounts ieb,
apps.ap_supplier_sites_all asa,
apps.ap_suppliers asp,
apps.ce_bank_branches_v cbbv
WHERE owners.primary_flag = 'Y'
AND owners.ext_bank_account_id = ieb.ext_bank_account_id
AND owners.ext_bank_account_id = instrument.instrument_id
AND payees.ext_payee_id = instrument.ext_pmt_party_id
AND payees.payee_party_id = owners.account_owner_party_id
AND payees.supplier_site_id = asa.vendor_site_id
AND asa.vendor_id = asp.vendor_id
and bank_party_id(+) = ieb.bank_id
--AND cbbv.branch_party_id(+) = ieb.branch_id
AND (
(INSTRUMENT.END_DATE IS NULL)
OR
( INSTRUMENT.END_DATE >= TO_DATE(SYSDATE) )
)
AND (
(IEB.END_DATE IS NULL)
OR
(IEB.END_DATE >= TO_DATE(SYSDATE))
)
group by payees.supplier_site_id ,
payees.org_id ,
payees.payee_party_id ,
cbbv.bank_name
You may have to edit this with the desktop Microsoft Word add-in. There's limited capabilities with the Oracle BI Publisher Stand-alone running on the server.
You have 100% control if you're editing the template in Word. Unfortunately, there's limited export capability to export your existing template. Oracle BI publisher stand-alone will export an XML file, which to my knowledge is not visually editable in Word. There is an ability to import an RTF file which you created in Word, though. So Install the BI Publisher desktop/Word add-in. Make a new file, save as .rtf format, use the tool to import an example XML file, add a table, and continue editing as you need to. If you need help with this, there's plenty of documentation out there to get you started. Also, there's a Template Viewer application that's also installed that will let you process the XML sample/data file and rtf file into Excel, PDF, or whichever you prefer.

OpenTBS Replace Text

Is it possible to replace text without having to create a TAG?
I'm using a template to fill some data in a word document. One of the things I need to fill is the revision number, something like: "1º Revision" ([onshow.rev])
But the generated file can be re-submited several times, and I need to increment the revision for each time, but since the tag [onshow.rev] is gone from the first time, I can't do it anymore.
Is it possible the replace just the text "1º Revision" with something line "2º Revision"?
thks
With TinyButStrong, You can directly modify the contents using $TBS->Source.
But, with OpenTBS over TBS, you have to take care that only the current sub-file is actually accessible by $TBS->Source.
For example, if you are working on an Ms Excel sheet, then you have to do a $TBS->PlugIn(OPENTBS_SELECT_SHEET, $Sheet) in order to select the sheet to modify.
Here is how to replace your item in the template :
$TBS->Source = str_replace("1º Revision", "2º Revision", $TBS->Source);

How to loop and extract data from various url's using the iMacros Addon for Firefox

I would like to extract data form a spacific url such as www.example.com/data.php?id=xx
Where xx is a number between 1 and 1000 (ie. the script should loop through) and extract the data so far I have the following script:
VERSION BUILD=7401110 RECORDER=FX TAB
T=1
SET !LOOP 1
URL GOTO=http://www.example/data.php?id={{!LOOP}}
TAG POS=2 TYPE=TD ATTR=TXT:* EXTRACT=TXT
Now how can I achieve this to loop properly also if a url eg www.example.com/data.php?id=4
does not exist no data is extracted but the script continues and finally how can I get the data to be outputted to a file?
Thanks
With the macro you wrote, if you use the Loop function (that is, hit the play loop button) the macro is going to load one url after the other and extract the desired data.
However, the data is not going to be saved, but presented to you in a popup at each step. To avoid that, include the command
SET !EXTRACT_TEST_POPUP NO
at the beginning. For the saving, use SAVEAS TYPE=EXTRACT
you need to set error ignore to make the script continue if data not found, use this:
SET !ERRORIGNORE YES

Pass data from workspace to a function

I created a GUI and used uiimport to import a dataset into matlab workspace, I would like to pass this imported data to another function in matlab...How do I pass this imported dataset into another function....I tried doing diz...but it couldnt pick diz....it doesnt pick the data on the matlab workspace....any ideas??
[file_input, pathname] = uigetfile( ...
{'*.txt', 'Text (*.txt)'; ...
'*.xls', 'Excel (*.xls)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select files');
uiimport(file_input);
M = dlmread(file_input);
X = freed(M);
I think that you need to assign the result of this statement:
uiimport(file_input);
to a variable, like this
dataset = uiimport(file_input);
and then pass that to your next function:
M = dlmread(dataset);
This is a very basic feature of Matlab, which suggests to me that you would find it valuable to read some of the on-line help and some of the documentation for Matlab. When you've done that you'll probably find neater and quicker ways of doing this.
EDIT: Well, #Tim, if all else fails RTFM. So I did, and my previous answer is incorrect. What you need to pass to dlmread is the name of the file to read. So, you either use uiimport or dlmread to read the file, but not both. Which one you use depends on what you are trying to do and on the format of the input file. So, go RTFM and I'll do the same. If you are still having trouble, update your question and provide details of the contents of the file.
In your script you have three ways to read the file. Choose one on them depending on your file format. But first I would combine file name with the path:
file_input = fullfile(pathname,file_input);
I wouldn't use UIIMPORT in a script, since user can change way to read the data, and variable name depends on file name and user.
With DLMREAD you can only read numerical data from the file. You can also skip some number of rows or columns with
M = dlmread(file_input,'\t',1,1);
skipping the first row and one column on the left.
Or you can define a range in kind of Excel style. See the DLMREAD documentation for more details.
The filename you pass to DLMREAD must be a string. Don't pass a file handle or any data. You will get "Filename must be a string", if it's not a string. Easy.
FREAD reads data from a binary file. See the documentation if you really have to do it.
There are many other functions to read the data from file. If you still have problems, show us an example of your file format, so we can suggest the best way to read it.

Resources