Challenging importxml task - google-sheets

I am stuck on a challenging import query from the following website
https://www.zara.com/tr/en/full-length-trousers-p07385169.html?v1=88239943&v2=1471790
The links shows a product by zara that has some size variations
for some reason they mark the out of stock variations as "disabled" in html. I am not sure how does that work.
my mission is to scrape the in stock variations. or all the variations but with a hint to the out of stock ones.
The =IMPORTXML(A1,("//span[#class='product-size-info__name']")) function returns all the variations without any note about the disabled ones.
is there is any way to get only the active variations? or all variations with any hint about the disabled ones?
Thanks in advance.

You can use this path to avoid getting the disabled elements:
=IMPORTXML(A1,("//ul[#class='product-size-selector__size-list']/li[not(#disabled)]"))
This will get all the sizes available and avoid the others.

The code for the item is this:
<li class="product-size-.......product-detail-info-88239091-item-2" disabled>......
So you should try to select all items without disabled> at the end.

Related

Playwright: Find icon by classname in near range of a defined text

Good evening,
I would like to ask if someone knows, if it's possible in Playwright to check if an icon - under certain conditions - is visible?
The conditions are:
the icon has a specific name, but appears multiple times on the site
it has to be in a certain range (lets say 15 pixel) of a unique text
My first idea was something like this...
await expect(page.locator('icon:near(:text("Specific text"), 15)'))
...but as you can see, I miss the option to declare the icons classname
Thanks in advance and have a nice evening.
finethen
According to the Playwright docs on matching by layout, those matchers “can be combined with regular CSS to pinpoint one of the multiple choices.”
If I’m understanding correctly that any css can be used, then you should be able to use the class name just fine. So basing off your example, you should be able to do something like
.yourclassname:near(:text("Specific text"), 15)
Hope that works for you!

Capybara: Finding a second checkbox which is identical to the first

I am writing tests for view files. I have a page with two checkboxes which allows the user to Select All items in two different lists. However, the checkboxes are part of a partial so are identical. I have managed to check the first one using:
first(:checkbox, "Select all").click
But I am unable to check the second. I have tried replacing first with last and with second but to no avail.
I think I may need to use the find selector but am struggling with that also. Any help much appreciated.
Thanks
UPDATE
It appears that this in fact another issue. I think that any checkbox that impacts on other checkboxes does not work as expected when "checked" by Capybara. So the current answers below work in the sense that they do check the checkbox, but the expected behaviour does not occur i.e. the checkboxes linked to them do not get "checked". I may be wrong though.
try this
# find the second checkbox
find('input[type="checkbox"]:nth-child(2)').click
You can use find all
all('input[type="checkbox"]', :text => 'Select all')[1].click
Whoops. Turns out it was a JS issue and not Capybara macthers! Thanks for the help though!

Not Showing Rich Snippet Rating

Snippet test link: http://www.google.com/webmasters/tools/richsnippets?q=www.oyuntc.com/hay-day.html
In the example turns out the stars but the stars do not appear in google search. What could cause a've tried all the codes I could not get any results.
I think it might be content-related issue: mark-up is fine, but google don't like your content. Mark-up is just recommendation, Google makes decision on its own. Try to make your entire page mark-up make more structured.
Also, try to make structure as Product - Review: Google Search with Rating Stars (schema.org)

SEO: URL for detail page, include categories or not?

I'm working on a new advert website and want to implement some good SEO URLs.
I got category URLs like:
/category
/category/sub-category
This seems ok. What about detail pages?
Option 1:
/announcements-and-notices/announcements-various/15880/suscipit-dis-molestie-malesuada-vestibulum-ut.html
Option 2:
/adverts/15880/suscipit-dis-molestie-malesuada-vestibulum-ut.html
In reality my website has a pretty long URLs due to multiple areas you can shop. So it would become:
/en/area-name/announcements-and-notices/announcements-various/15880/suscipit-dis-molestie-malesuada-vestibulum-ut.html
/en/area-name/adverts/15880/suscipit-dis-molestie-malesuada-vestibulum-ut.html
Which detail page would be a better URL? The first option seems to be better if the product has no long/good title. The second seems better as its the most relevant one and shortest especially with long category names.
I would like to hear your thoughts!
EDIT:
I found this two google docs:
http://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDYQFjAA&url=http%3A%2F%2Fwww.google.com%2Fwebmasters%2Fdocs%2Fsearch-engine-optimization-starter-guide.pdf&ei=lXyaT6T_L8zR4QSM4c2qDw&usg=AFQjCNEMj8KHxhxQz9cMLoMxMDiLdrAbJw
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=76329
I think I will be going for /adverts. Anyone disagree?
i have seen many of SEO analysts miss something about optimizing their webpage and that is your page will be optimized for only some keywords not all keywords. it is not important how length is your URL. you should first analyze whether the contents in your webpage is rich enough to have such URL with these keywords or not. if the answer for every keyword is yes then the more length will give you the more rank.
I think you can even set your pages up in a way to use only the slug and skip the id, such as:
/adverts/suscipit-dis-molestie-malesuada-vestibulum-ut
or even just:
/suscipit-dis-molestie-malesuada-vestibulum-ut
like this and refer straight to the adverts controller and the advert itself, which has this slug assigned to it (the one with id 15880).
This way you'll have nice and clean URLs. Just assign and keep an unique slug for each advert and handle it using .htaccess, or dynamically inside the code of your site, if the system allows it.
Cheers.

auto_complete_for: prevent the first item from being auto-selected

The auto_complete_for dealio from script.aculo.us is great an all, but is there a way for me to selectively disable the fact that it always auto-selects the first item in the list?
The problem is that, if I want to type my own entry that is new, and novel, I don't want the first item in the list to be auto-selected. The reason is because when I TAB out of the field, it selects, and fills the text box with that first item.
I got around that, somewhat, by making the first item in the list the same as what I'm typing, but that's not perfect either, because the auto_complete list doesn't always update with every keystroke, depending on how fast I type. I've tried setting the list refresh rate to the lowest value (1 millisecond) but no go.
What I really want is an option in "auto_complete_for" that doesn't select that first item at all - the same way that Google Instant doesn't automatically select the first suggested search phrase - you have to arrow-down to select one.
Maybe I can do this via an HTML option that I'm missing?
Looking at the source, there doesn't appear to be an option for that, but I bet if you changed line 284 of controls.js to this.index = -1; it would do what you want.
Otherwise, it might be time to look for a different autocomplete widget.
If your requirements are too far away from the available plugin, then I guess there is no point in tinkering around. Its best to write your own JS code.
You might want to consider this: https://github.com/laktek/jQuery-Smart-Auto-Complete
or this : https://github.com/reinh/jquery-autocomplete
I'll add another alternative that works great with Rails 3:
http://github.com/crowdint/rails3-jquery-autocomplete
I recently implemented auto complete for more than a field for Rails 2.0.2.
The plugin I used is:- https://github.com/david-kerins/auto_complete . Not sure if it supports Rails 3.
I have also encountered issues on implementing the above scenario and have posted questions( Implementing auto complete for more than one field in Rails ; Implementing a OnClick kind of functionality and formatting wrt Rails Partial-Views ) on stackoverflow for the same, I have been lucky on getting things working for me based on my requirement.
Kindly refer to these questions, they might have relevance to your requirement.

Resources