get css element with space selenium [duplicate] - python-3.x

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

Related

jQuery text() function not working on twitter when using CJS chrome extension [duplicate]

This question already has answers here:
Using jQuery $(this) with ES6 Arrow Functions (lexical this binding)
(5 answers)
Closed 2 years ago.
I am using a google chrome extension called CJS which allows you to run javascript code on websites.
I have it injecting jQuery, and then running this code on twitter's stream
setInterval(()=>{
jQuery('article').each(index=>{
console.log( index + ": " + jQuery( this ).text() );
})
}, 1000)
The ultimate goal is to hide tweets that are retweets.
Twitter does have a DOM article wrapped around each of the tweets, so the plan was to get those, iterate over them, and if the text includes "retweet", hide the article.
It is able to iterate over them, and in the console it just shows the indexes of the items, but the text of jQuery(this) ends up being an empty string, even when the content is fully loaded.
The issue is with using a fat arrow function (index)=>{... instead of function(index){... in the each section. This means that the this referred to the scope of the calling function rather than the scope for the jQuery dom element.

How to click on this link to the next page? [duplicate]

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.

unable to render image using the <h:graphicImage> syntax of JSF 2 [duplicate]

This question already has answers here:
How to reference CSS / JS / image resource in Facelets template?
(4 answers)
Closed 6 years ago.
I'm looking for some help in using the of JSF 2. I want to display an image in a webpage, but the image comes from a resource folder in my project directory structure. The problem is, the webpage doesn't load the image.
Here is my project directory structure
My code to load the image into the webpage
<h:graphicImage library="images" name="captain america.jpg"/>
when I run my code, it doesn't display the image. How can I load my images from a resource folder to the webpage?
Use the value attribute
And image folder should be in root level same as that of web inf

Internationalization message with HTML tags [duplicate]

This question already has answers here:
Including HTML in JSF resource bundle string - possible? [duplicate]
(1 answer)
JSF please don't escape my html [duplicate]
(3 answers)
Closed 6 years ago.
I have the following message in my resource bundle properties file:
message1=This is a <strong>message</strong>
And in my facelets page I have:
<p>#{bundle.message1}</p>
However when the message is displayed it shows the tags as text so I see
"<strong>message</strong>"
instead of "message" in bold.
What do I have to do to see it in bold?

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;
}

Resources