Scrapy: Item discrepancy - scrapy

Scenario: a page with multiple items, each consisting of title, description, image. What happens when one of the items are missing the title? How does scrapy handle it? It seems that scrapy blindly selects all titles //div[id='content']/ul/li/div[id='title']/text(),
Expected output is that that row will have a missing title. But I fear that since it blindly selects all titles on the page without considering the item context. If the 5th item is missing title, wouldn't it mistakenly use the 6th item's title instead?
title1 | description | image
.
.
title4 | description | image
title6 | description | image <--- it's supposed to be missing the title.
| description | image
Does scrapy have a way to deal with this problem?
A workaround I was thinking would be to look at the parent item element, and then, look inside that item. If something is missing don't show it.

there are variety of ways you can handle this situation
1) you can implement a pipeline that can skip items that are not required
2) you can add check in your extraction part to only yield/return an item that is required
you needs to understand Scrapy is a high level crawling Framework , that is also providing builten support for data extraction , you can use any library for extraction you would like to.

Related

How to differentiate test description for parameterized data testing with selenium/cucumber?

How to differentiate test description for parameterized data testing with cucumber? Because for multiple testdata, the description in the scenario outline is showing same when viewing the cucumber report.
Below I am giving an example. On cucumber result, the scenario outline "Verify correct status displaying after filtering" -always visible as same for all the testdata. Is it possible to show three different description for three different testdata? Like "Verify correct verified status displaying after filtering" / "Verify correct pending status displaying after filtering" / "Verify correct rejected status displaying after filtering".
#flights
#flight01
Scenario Outline: TC003_Verify correct status displaying after filtering
Given I am in the xyz application
When I navigate to abcd page
Then Select status "<Status>" from the filter
Then Verify correct "<Status>" should be displayed
Examples:
|Status |
|Verified|
|Pending |
|Rejected|
The way to do that would be to add the parameter to your scenario outline the same way you do for your steps:
eg.
TC003_Verify "<Status>" status displaying after filtering for "<Status>"
This way your scenario results will better convey what you are testing too.
HTH.
The easy way is to just write 3 different scenarios with different titles. There is absolutely no need to use scenario outline when cuking.
When I tested for multiple test data,cucumber report shows the data itself and marked it with pass or fail colors, screenshots below . The description in scenario outline is same but it also copies all the data and it even provides the error. Imo, this eliminates the need to have separate scenario outline with data in it.
and
You have not mention which test runner are you using but the above screen shots are from cucumber 6.9.1 and Junit5 and in junit-platform.properties , you can mention cucumber.plugin = html:target/cucumber.html to have this report generated

SSRS Loop through data, adding a new title if the chapter/section changes

I'm building an SSRS report in Report Builder 3.0 (2014). I have five sections of data I'm working with: inspection number, chapter, section, code, and description. The report is only going to show data for one inspection, so all data is filtered on InspNo first. There are often multiple codes associated with an InspNo.
What I have: for every code associated with an inspection, the code is listed along with its description.
What I need: I need to add the chapter and section info, but only when it changes. For example, let's say the codes associated with an inspection are 302.7, 304.10, 304.12, and 505.1. I would like the result to be as follows:
Chapter 3
Section 302
302.7 - Description
Section 304
304.10 - Description
304.12 - Description
Chapter 5
Section 505
505.1 - Description
I have tried using Lists, but the chapter and section get repeated for every code. Any ideas how to make it work?
****UPDATE****
I'm getting closer to a solution. Right now I'm using a combination of textboxes and lists. The chapters and sections are text boxes, and the codes/descriptions are lists. All of the elements have a visibility expression using InStr. The lists are working perfectly. However the text boxes are giving me issues.
It seems my visibility expressions on elements outside of lists are only looking at the first piece of the pulled data. In the example above, Section 302's visibility expression is =IIF(InStr(Fields!FAILEDCODE.Value, "302") > 0, False, True). This is working great because the first code is 302.7. Section 304's visibility expression is =IIF(InStr(Fields!FAILEDCODE.Value, "304") > 0, False, True). This text box is always hidden. It seems like Report Builder is only checking this InStr value against the first line of data, not the entire set. Does anyone know if this is accurate or if there's a workaround?

In Shopify, am i able to change the display of variants title?

my variants title is “pack/4 bottles:4/PK”
“4/PK” is needed for shipping company to catch specific item.
However, it looks ugly when "4/PK" is displayed on page
Is there a way to hide it? Which liquid template should i touch?
Should I use
{{variant.title|move:'4/PK'}}
where should i put this code?
While this sounds more like something that should be assigned as an option for your variants instead of in the title, you can hide the part of the variants title that you don't want via using split and first
https://help.shopify.com/themes/liquid/filters/string-filters#split
split can be used to split a string (in this case your variant.title) into an array based on a set delimiter to divide it.
So you could do something only the lines of
{{variant.title | split: ':' | first }}
In your case, the output of the above would be: pack/4 bottles.
As for which liquid templates you will need to edit this into ... it will depend on your store. However some common areas would be:
product.liquid
cart.liquid
I highly recommend you read the the shopify liquid documents Here
Also, make sure to make a backup theme before doing any liquid changes in your theme that you are unsure of.
Hope this helps!

Bigcommerce - add category name to product page layout

I'm changing a theme in Bigcommerce, and I should put the product Category name in Product page layout, but there isn't any panel that could do that, and I don't really know is it possible?
I can get the list of all categories, but that's not what I want, and I would like to do it without unecessary JavaScript.
So, for example..
I have few categories, and when I'm in each of that categories product, this product category should be writen.
Category - Product - Headline ( should be writen in this page )
Car - Honda - Car
Cloth - Shirt - Cloth
etc..
If anyone knows how it can be made, it would be very appreciated.
Thanks!
I believe the only place the category is pulled onto the product page is through the product breadcrumbs. You could use a simple Javascript to get the category set in the product breadcrumbs and then display it somewhere else.
Something like
Get breadcrumbs
Find the item before the ones that matches the product name
Set it's text as a variable
Set the element where you actually want the cat name to appear to contain the text of the var

How to output a plaintext for each loop with Jade view engine

I'm trying to render out a plaintext string for emailing using the Jade view engine. I'm having trouble getting the right syntax for a plaintext output using a for each loop. Works fine with regular HTML, just not the plain text version:
| Bill to:
| #{customer.active_card.name}
|
- each lineitem in invoice.lines
= lineitem.description
Outputs
Bill to:
Freddy Mac
<p>Line item 1 description</p><p>Line item 2 description</p>
I can't figure out how to format the lineitem.description line so that I get a simple plaintext output so that it would look like this:
Bill to:
Freddy Mac
Line item 1 description
Line item 2 description
Any suggestions on how to tackle this ridiculously obscure edge case for Jade?
Many thanks!
Are you sure the <p> tag isn't really in the lineitem.description variable value itself? I tried your example and didn't get an unexpected <p> tag.
Second note that if you want plain text, you probably don't want jade's default HTML escaping, so use != instead of =.
For what it's worth, jade is really heavily focused on HTML specifically and using it for plain text is probably going to be annoying. Have you considered an alternate templating language like underscore templates?