SEO - anchor and b tag combination for keywords - seo

On some pages, I put keywords within anchor tags. What's better to use for Google search:
keyword
or
<b>keyword</b>
or
<b>keyword</b>
Thanks in advance!

Doesn't make difference.
However, general usage of <b>, <i>, <u> tags is not advised. Use CSS to adjust text display properties.

Related

How do I add HTML tags and links in QnA-maker?

I have tried the suggestions provided for other similar questions but they didn't work.
here 2 example:
1) Link: name of your link is changed by QnAMaker during the save and train step in name of your link](https://url.com)) and it is diplayed in the test feature
name of your link](https://url.com))
2) <b> bold text </b> is not changed in bold and the same thing happens with the escaped html
Did you consider markdown? You examples are supported.
Cheatsheet to help you on you way.

Scrapy - Cleaning up text[/p] from nested links[/a] etc

I am new to python and scrape as well. Nevertheless, I spend a few days trying to scrape news articles from its archive - SUCCESSFULLY.
PROBLEM is that when I scrape CONTENT of the article <p> that content is filled with additional tags like - strong, a etc. And as such scrapy won't pull it out and I am left with news article containing 2/3 of the text. Will try HTML below:
<p> According to <a> Japan's newspapers </a> it happened ... </p>
Now I tried googling around and looking into the forum here. There were some suggestion but from what I tried, it did not work or broke my spider:
I have read about normalized-space and remove tags but it didn't work. Thank you for any insights in advance.
Please provide your selector for more detailed help.
Given what you're describing, I'd guess you're selecting p/text() (xml) or p::text (css), which is not going to get the text in the children of <p> elements.
You should try selecting response.xpath('//p/descendant-or-self::*/text()') to get the text in the <p> and all it's children.
You could also just select the <p>, not its text, and you'll get its children as well. From there you can start cleaning up the tags. There are answered questions regarding how to do that.
You could use string.replace(,)
new_string = old_string.replace("<a>", "")
You could integrate this into a loop which iterates over a list that contains all of the substrings that you want to discard.

cssSelector("select[title=\"Sort By\"]")

In a selenium script Sorting a dropdown using
new Select(driver.findElement(By.cssSelector("select[title=\"Sort By\"]"))).selectByVisibleText("Name");
Can anybody please explain me this part cssSelector("select[title=\"Sort By\"]" of above statement.
Thanks!
cssSelector("select[title=\"Sort By\"]")
this is one of the technique to locate web element/elements.
You must have heard about xpath, which is one of the way to locate element/elements in a web page.
Further more , select is tag in HTML. title is attribute and Sort By is value of attribute.
Just like this :
HTML :
<select id="sel" class="drop-down" title="Sort By">
<options>..</options>
<options>..</options>
<options>..</options>
</select>
Now If you have to write cssSelector , you can write like this :
tagname[attribute="attribute value"]
select[id="sel"]
or
select[class="drop-dwon"]
or
select[title="Sort By"]
Hope this will be helpful !
new Select(driver.findElement(By.cssSelector("select[title=\"Sort By\"]"))).selectByVisibleText("Name");
You are selecting by CSS selector https://www.w3schools.com/cssref/css_selectors.asp. The alternative is XPath which is more powerful but harder to learn.
What this part By.cssSelector("select[title=\"Sort By\"]") does is select all select elements that have title attributes set equal to "Sort By". Although by prefixing driver.findElement( you are requesting just one element, the first. At least you would be if it was python, Java might differ but was not in your question nor tags.

How to check if a text is in web page in Robot Framework and Selenium

I'm currently creating an automation test for a website and I want to check if a text(s) is in the page. I could use the keyword 'Page should contain' to check; however, I want it to be a little more specific on having it check specifically where the text exist in the page. Is there a way I can have it check if a specific div contains the text?
You can easily do this with a built-in Selenium2Library tags.
For a partial match use this:
Element Should Contain locator expected_text
For an exact match use this:
Element Text Should Be locator expected_text
If your HTML code is something like:
Your div tag and need to find FindMe
<div class="gwt-Label">This FindMe DIV</div>
Then you can find "FindMe" text like:
//div[#class='gwt-Label'][contains(string(),'FindMe')]

Updating href attributes in link tags

I would like to change the href attributes of the link tags that have the following attribute :
rel="apple-touch-icon-precomposed"
Does anyone know how to achieve that ?
Thank you
Ext.select can be used to search for DOM elements. To understand how to select elements in the DOM, one may have a look at jQuery Selectors documentation.
Ext.dom.Element.set can then be used to change the href attribute. Note that even if Ext.select returns a collection, all methods of Ext.Element can be used on the collection.
In short, this gives something like this:
Ext.select("a[rel='apple-touch-icon-precomposed']").set({href: 'my-other-link.html'});