See code
https://prnt.sc/fscdi5
I want to get the row number containing the specific date string and the String TestTraining..
I can then use this to go to the Download Certificate link to click the correct link.
to get row by any containing text:
//*[contains(text(),'someText')]/preceding::tr[1]
actually you can find any tr part by any attribute and use found locator to get it's row:
locator/preceding::tr[1]
Related
This formula below does extract the file ID and yields the correct image url. Now, how to fetch the correct url to extract that ID from by verifying a key using VLOOKUP() maybe?
I've seen that REGEXEXTRACT() requires JOIN() and could this be the reason why it doesn't work?
Current formula doesn't populate the rows, but only the one it's sitting in:
=arrayformula(iferror(image("https://drive.google.com/uc?export=view&id="®exextract(VLOOKUP($F$3:$F$100,$I:$I,2,0),"d/(.+)/view")),""))
Here's a file for tests, if you feel like operating.
Thank you!
Your formula is working! Just change $I:$I with $I:$J.
You need to put the whole range including the column to look at and the column with the results.
I have tried this, but I get three dots
=IMPORTXML("https://covid19.sabah.digital/covid19/","//span[#class='number-last_updated']")
When I saw the HTML data, it seems that the last updated date is displayed by Javascript. By this, unfortunately, the value cannot be directly retrieved with IMPORTXML. This has already been mentioned in the comments.
When I saw the HTML data again, I noticed that the information of date is included in https://data.covid19.sabah.digital/global.json. From this data, how about retrieving the last updated date? In this answer, as a workaround, in order to retrieve the last updated value, I would like to propose to retrieve the data using the following sample formula.
Sample formula:
=TEXT(MAX(ARRAYFORMULA(DATEVALUE(REGEXEXTRACT(QUERY(IMPORTDATA(A1),"SELECT Col1 WHERE Col1 contains 'date'"),"\d{4}-\d{1,2}-\d{1,2}"))))+1,"yyyy-MM-dd")
In this formula, please put the URL of https://data.covid19.sabah.digital/global.json to the cell "A1".
The flow of this formula is as follows.
Retrieve the JSON data using IMPORTDATA.
Retrieve the data values from the retrieved data using QUERY.
Convert the text to the serial number using DATEVALUE.
Retrieve the max value using MAX.
It seems that when this value is added by 1, it is the updated date.
If you don't need this, please remove +1 from the formula.
Convert the serial number to the text using TEXT.
Result:
References:
IMPORTDATA
QUERY
DATEVALUE
MAX
TEXT
I am trying to scrape this site using import.io: ScoreCard
I am able to get the batting scores successfully but I want to insert additional column in the end which can tell me about the innings. So it should be relative to the name of batsman.
I tried to use XPATH: //*[#id="innings_1"]/div[1]/div/h4/b
but that will always return First Inning as ID is "innings_1".
Other IDs are innings_2/3/4 etc. Is there any way in XPATH where I can get this element relative to Batsman column?
Here is what I did in order to get the desired result:
I used following XPATH value.
.//a/ancestor::div/div[1]/div/h4/b
.//a was providing me name of Batsmen. I searched for its ancestors and the path div[1]/div/h4/b was being used by only Innings section.. So it did the trick :)
Try using starts-with():
//*[starts-with(#id,'innings_')/div/div/h4/b
I'm building a report where I have a subreport. This subreport brings some data through XPath, this means it's everything strings from a XML. One of the columns of this subreport has some values, where I need do sum them and show in the end of the table.
I don't know how to put this to work. I've tried to create a variable with sum parameter, but it does not work.
Did anybody need this before?
Scenario:
I load a lot of values from a XPath query, e.g:
/something/something1/something2
This query returns some fields according to my needs. With them I build a table (in a subreport). The problem is: the last column (4), values are strings from XML.
iReport version: 3.0.0
Really thanks!
Solution:
What I needed? According to the original post, a column with strings read from a XML through XPath and a footer with the sum.
Result from column SUM
What to do? Create a variable where you'll keep your sum. After created, edit it. e.g:enter image description here
Fill variable expression with the format you need. Here I used
new BigDecimal($F{theFieldToSum});
Click ok. Now the variable is created, you must create a new TextField where you'll show your sum. Create it and edit it. Here I used the following format:
new java.text.DecimalFormat("#,##0.00").format($V{theVariableYouCreatedBefore})
Click "Apply" and that's all. Compile your report and now you'll have the expected result. For sure, you can do some adapt, but in general this is the process.
I'm trying to create xpath expression which will work with selenium using following html snippet.
Below is table contains various row that gets incremented with uniquely generatedid(for example in following snippet that id is 1000).
Selenium has created following expressions when row of id 1000 was added in table. However instead of using id, I want to create xpath by using 3rd data element in row which is (MyName) in html snippet.
A possible suggestion is to not use xpath whenever possible.
http://saucelabs.com/blog/index.php/2011/05/why-css-locators-are-the-way-to-go-vs-xpath/
You need to convert the places in the XPATH where it is referring to the row by its ID to its relative position in the table.
In all of your XPATHs, you would change tr[#id='1000'] to tr[3]
Your first example XPATH would look liek this:
//tr[3]/td[1]/a[1]/img //tr[#id='1000']/td[1]/span/a/img
Your second example would follow similarly:
//tr[3]/td[1]/span/a/img
As would your third:
//tr[3]/td[1]/a[2]/img
Hopefully you are now able change the rest of them.