How to click on this link to the next page? [duplicate] - node.js

This question already has answers here:
How do I click this link using nightmare?
(2 answers)
Closed 4 years ago.
Here is everything involving the link:
<a class="selected" data-images="{"detail_url":"//assets.supremenewyork.com/148393/ma/hBwFmRXhVKI.jpg","zoomed_url":"//assets.supremenewyork.com/148393/zo/hBwFmRXhVKI.jpg"}" data-style-name="Black" data-style-id="19033" data-sold-out="false" data-description="null" href="/shop/bags/lkav6jh17/xfdbgpiea" data-no-tubolink="data-no-tubolink"><img width="32" height="32" src="//d17ol771963kd3.cloudfront.net/148393/sw/hBwFmRXhVKI.jpg" alt="Hbwfmrxhvki"></a>
I use nightmare with node coded in atom and would like to click on the black bookbag from the url: http://www.supremenewyork.com/shop/bags/lkav6jh17/p9ylgt8vm
using the "data-style-name="Black" found in the elements.
I've tried:
.click("data-style-name ='Black'")
which gave me the error:
Failed to execute 'querySelector' on 'Document': 'data-style-name ='Black'' is not a valid selector.
Not sure what to do to click but any help would be great.

to click what I wanted I did:
.click('a[data-style-name="Tan"]')
It was an attribute so i needed to specify that.

Related

Handling SVG elements using Karate UI Automation [duplicate]

This question already has an answer here:
Karate UI button click support
(1 answer)
Closed 2 years ago.
I am quite new to Karate UI automation and I have a front end UI that has a SVG element which when clicked brings a drop down.
When I am writing the UI test for it, I get javascript evaluation error and hence seek some advice/help.
Here are the screenshots of the UI element and its CSS locator clearly seen on the screen
This is how the CSS locator shows up for the SVG element
This uniquely identifies the SVG element(the plus button)
svg[class='svg-inline--fa fa-plus-square fa-w-14 ']
This is the part of code that I have written to click it
And click("svg[class='svg-inline--fa fa-plus-square fa-w-14 ']")
And here is the error I get:
javascript evaluation failed: click("svg[class='svg-inline--fa fa-plus-square fa-w-14 ']"), js eval failed twice:document.querySelector("svg[class='svg-inline--fa fa-plus-square fa-w-14 ']").click(), error: {"type":"object","subtype":"error","className":"TypeError","description":"TypeError: Cannot read property 'click' of null\n at <anonymous>:1:78","objectId":"{\"injectedScriptId\":2,\"id\":3}"}
I tried various things that can uniquely identify the SVG element like using the compelete Xpath and also using the parent class name(though it was already unique with just the class name) but it still did not work. I tried wildcard locators as well but since there is no text/name of the element, it did not work. When the tags are say input or button etc the same way of css locator works but SVG ones did not for me.
tagname[unique_id of the element like key=value pair]
I am wondering if we need to use a different way to identify SVG elements using Karate UI? The same path when used in Selenium worked.
Since this is a UI that requires VPN connection and secure acccess, it may not be possible to provide a minimum code to try and replicate it. But am happy to provide more details if needed.
I have many such SVG elements on my UI and any help in this would be greatly appreciated.
Use selector hub as an extension to chrome, firefox, edge and opera. Ive only used with chrome and it worked fine and allowed me to quickly and easily find svg relative / absolute xpath. This worked no problems in a find and click capacity on numerous svg elements (via karate script)
2 suggestions.
Try to get some nearby element and work backwards: https://stackoverflow.com/a/63988977/143475
Figure out the location of the SVG and fire a mouse-click: https://stackoverflow.com/a/63828083/143475
Unable to give you specifics without a way to replicate, but - it should be possible to find a "pattern" so you can write a custom function as described in the docs. So that can be your goal, something like this:
* svgClick('svg-inline--fa')

get css element with space selenium [duplicate]

This question already has answers here:
Is there a way to find an element by attributes in Python Selenium?
(3 answers)
Closed 3 years ago.
Is there a structure below that I need to get the value of the tag between>
For example
driver.find_element_by_xpath (u '//span[contains(text(),"name")]')
HTML
<span itemprop="name">Colombia U20 vs Ukraine U20</span>
Try the following xpath.
driver.find_element_by_xpath('//span[contains(text(),"Colombia U20 vs Ukraine U20")]').text
OR
driver.find_element_by_xpath('//span[contains(.,"Colombia U20 vs Ukraine U20")]').text
OR
driver.find_element_by_xpath('//span[#itemprop="name"]').text
If you want to use css selector try that.
driver.find_element_by_css_selector('span[itemprop="name"]').text

Displaying vertical images with Inno Setup [duplicate]

This question already has answers here:
WizardImageFile does not work in Inno Setup 5.5.8
(2 answers)
Closed 4 years ago.
If you look here it shows a vertical image on the left. Example:
Now, I have the entries in my [Setup] section:
WizardImageFile=compiler:wizmodernimage-is.bmp
WizardSmallImageFile=compiler:wizmodernsmallimage-is.bmp
Yet for me, I never get images showing on the left:
Has the vertical image been dropped? I verify the files are in the compiler folder.
I found this answer. It states:
The WizardImageFile is shown on the Welcome and Finish pages. However, the Welcome page is skipped by default now (see DisableWelcomePage), so it will normally only be visible on the Finished page. (This is enabled by default, but it is possible that you disabled that too -- see DisableFinishedPage.)
The WizardSmallImageFile is shown on all other pages.
That explains why I can’t see the images. Wonder by the Welcome Page is off by default?
I found this which states:
Don't use Welcome pages—make the first page functional whenever possible. Use an optional Getting Started page only when:
The wizard has prerequisites that are necessary to complete the wizard successfully.
Users may not understand the purpose of the wizard based on its first Choice page, and there isn't room for further explanation.
The main instruction for Getting Started pages is "Before you begin:".

Use of different fonts such as malayalam,hindi etc in a website [duplicate]

This question already has answers here:
Fonts on the Web [duplicate]
(10 answers)
Closed 8 years ago.
I am new to PHP. I am developing a news website in different languages.I am using ML-TTKarthika font for malayalam. My problem is that this font is not supported in all browers (Chrome,Opera). How I solve this problem. In my site Hindi,Tamil fonts are also needed. Please anyone give me an answer..Thanks in advance.
This should help you: http://www.w3schools.com/css/css3_fonts.asp
Especially the Part "Using The Font You want"
Basically you can provide a Font with CSS:
#font-face
{
font-family:myFirstFont;
src:url(/path/to/font.woff);
}
And then use it:
body
{
font-family:myFirstFont;
}

Can chrome.tabs.executeScript() be called from within a content script? [duplicate]

This question already has answers here:
"Cannot read property of undefined" when using chrome.tabs or other chrome API in content script
(4 answers)
Closed 1 year ago.
I tried to look for this in the chrome documentation but I didn't see anything, especially in the "Security" section in the chrome.tabs documentation. The typical approach in examples I've seen is to send a message to the background page. The background page then calls chrome.tabs.executeScript(). If I can do it from the content script that would be a little easier.
Content scripts cannot call any Chrome API methods except couple from chrome.extension.* package.
Unless you are doing this to save content script filesize, why not just have that code you are planning to execute in a content script from the beginning?

Resources