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
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 am trying to crawl the following website https://goo.gl/THqDhD using import.io tool. I used the connector tool to parse the whole search result for specific query (and include the pagination), and successfully chosen all the rows in the search result, but was unable to select the items'image box (as column)
import.io contain manually xpath overriding for the selected, so I tried to select images in the search results using the following xpath:
.//*[#id='container-inner']/div[3]/div[4]/div[*]/div[1]/div/a/
which should represent the columns of the table, but I got the following problem
What you have selected is not within a result
The result here is the previous selected rows, but I inspected the item box and made sure that the selection is inside. Any help please?
I am trying to use XPath as part of a data scraper in order to scrape random comments from reddit for a project. The problem is, the comment forms have unique IDs that change on every page and within comment indent levels. I'm not sure how to make XPath target all of the comment fields with these different IDs.
An example is shown below:
//form[#id='form-t1_cj8cyupxa3']/div
//form[#id='form-t1_cj8e0iyx6w']/div
If there is some pattern to the id then try e.g. //form[starts-with(#id, 'form-')]/div
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.