Why does Google not accept my address for jobLocation in microdata? - structured-data

What is the problem with my code when tested with https://search.google.com/structured-data/testing-tool?
I have tried to set up structured data for JobPosting and then added location. But i dont have an exact postal address: so no zip code and no street just a city.
<div itemscope itemtype="http://schema.org/JobPosting">
<h2 itemprop="title">Data Analyst</h2>
<span itemprop="description">
<strong>Company:</strong>
<span itemprop="hiringOrganization">
<span itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">
Euro London Banking and Finance Germany
</span>
</span>
</span>
</span>
<p><strong>Location:</strong>
<span itemprop="jobLocation">
<span itemscope itemtype="http://schema.org/Place">
<span itemprop="address">
<span itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="addressLocality">Mycityname</span>
</span>
</span>
</span>
</span>
</p>
<p><strong>Employment type:</strong>
<span itemmprop="employmentType">
Full-time
</span>,
<span itemprop="workHours">
40 hours per week
</span>
</p>
<p><strong>Base salary:</strong>
<span itemprop="salaryCurrency">
EUR
</span>
<span itemprop="baseSalary">
35000
</span>
</p>
<p><strong>Responsabilities:</strong></p>
<ul itemprop="responsibilities">
<li>a</li>
<li>b</li>
<li>c</li>
</ul>
<p><strong>Educational requirements:</strong>
<span itemprop="educationRequirements">
Bachelor's degree
</span>
</p>
<p><strong>Experience requirements:</strong>
<span itemprop="experienceRequirements">
At least 2 years of working experience, however recent graduates with relevant technical knowledge and experience through
internships, etc. will also be considered
</span>
</p>
<p><strong>Qualifications:</strong></p>
<ul itemprop="qualifications">
<li>Profound knowledge of SQL Server and relational databases</li>
<li>Profound knowledge of Visual Basic for Applications</li>
<li>Profound knowledge of Microsoft Excel and Access</li>
<li>Knowledge in ASP.Net and HTML is preferred</li>
<li>Fluent in English; knowledge of the German language is preferred but not a must</li>
</ul>
<p><strong>Skills:</strong></p>
<ul itemprop="skills">
<li>Good analytical skills</li>
<li>Good communication and interpersonal skills</li>
<li>Ability to work in teams</li>
<li>Stress resilient, goal-oriented and efficient</li>
</ul>
<p><strong>Date posted:</strong>
<span itemprop="datePosted">
2011-11-29
</span>
</p>
</div>
To me it seems that I can have text value for addres property. that is also what schema.org says. still it does not get verified :(

Use itemprop and itemtype in the same span
<span itemprop="jobLocation" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="addressLocality">Mycityname</span>
</span>
</span>

The Place type can accept Text as well as a postalAddress type (http://schema.org/address) therefore you can do the following as a minimum and still be valid:
"jobLocation": {
"#type": "Place",
"address": "Central City"
}
I just tested it and although you will get warnings, you will get no errors.

Related

How to get a specific div's inline style using cheerio?

I'm trying to get a div's inline styling (background image) using cheerio on node.js.
<div class="">
<div class="news-card z-depth-1" itemscope itemtype="http://schema.org/NewsArticle">
<span content="" itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage"
itemid="https://example.com/en/news/nag-ashwin-seeks-mahindras-help-to-build-futuristic-vehicles-for-film-mahindra-replies-1646392977128"></span>
<span itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">
<span itemprop="name" content="Daisy Mowke"></span>
</span>
<span itemprop="description"
content="Nag Ashwin seeks Mahindra's help to build futuristic vehicles for film, Mahindra replies"></span>
<span itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url"
content="https://static.example.com/example/images/v1/variants/jpg/m/2022/03_mar/4_fri/img_1646391607355_815.jpg?">
</meta>
<meta itemprop="width" content="864">
</meta>
<meta itemprop="height" content="483">
</meta>
</span>
<span itemtype="https://schema.org/Organization" itemscope="itemscope" itemprop="publisher">
<span itemprop="url" content="https://example.com/"></span>
<span itemprop="name" content="example"></span>
<span itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<span itemprop="url"
content="https://assets.example.com/example/images/v1/variants/jpg/m/2018/11_nov/21_wed/img_1542823931298_497.jpg"></span>
<meta itemprop="width" content="400">
</meta>
<meta itemprop="height" content="60">
</meta>
</span>
</span>
<div class="news-card-image"
style="background-image: url('https://static.example.com/example/images/v1/variants/jpg/m/2022/03_mar/4_fri/img_1646391607355_815.jpg?')">
</div>
<div class="news-card-title news-right-box">
<a class="clickable"
onclick="track_GA_Mixpanel({'hitType': 'event', 'category': 'TitleOfNews', 'action': 'clicked', 'label': 'Nag%20Ashwin%20seeks%20Mahindra's%20help%20to%20build%20futuristic%20vehicles%20for%20film%2C%20Mahindra%20replies)' });"
style="color:#44444d!important"
href="/en/news/nag-ashwin-seeks-mahindras-help-to-build-futuristic-vehicles-for-film-mahindra-replies-1646392977128">
<span itemprop="headline">Nag Ashwin seeks Mahindra's help to build futuristic vehicles
for film, Mahindra replies</span>
</a>
<div class="news-card-author-time news-card-author-time-in-title">
<a
href="/prev/en/news/nag-ashwin-seeks-mahindras-help-to-build-futuristic-vehicles-for-film-mahindra-replies-1646392977128"><span
class="short">short</span></a> by <span class="author">Daisy Mowke</span> /
<span class="time" itemprop="datePublished" content="2022-03-04T11:22:57.000Z">04:52
pm</span> on <span clas="date">04 Mar 2022,Friday</span>
</div>
</div>
<div class="news-card-content news-right-box">
<div itemprop="articleBody">Director Nag Ashwin, who's shooting 'Project K' starring
Prabhas, Amitabh Bachchan and Deepika Padukone, sought Anand Mahindra's support in
building futuristic vehicles for the movie. "How could we refuse an opportunity to help
you envision the future of mobility?" Mahindra responded. "Chief of Global Product
Development #Velu_Mahindra will...happily throw his weight behind you," he added.</div>
<div class="news-card-author-time news-card-author-time-in-content">
<a
href="/prev/en/news/nag-ashwin-seeks-mahindras-help-to-build-futuristic-vehicles-for-film-mahindra-replies-1646392977128"><span
class="short">short</span></a> by <span class="author">Daisy Mowke</span> /
<span class="time" itemprop="dateModified" content="2022-03-04T11:22:57.000Z">04:52
pm</span> on <span class="date">04 Mar</span>
</div>
</div>
<div class="news-card-footer news-right-box">
<div class="read-more">read more at <a class="source"
onclick="track_GA_Mixpanel({'hitType': 'event', 'category': 'ReadMore', 'action': 'clicked', 'label': 'Hindustan%20Times' });"
target="_blank"
href="https://www.hindustantimes.com/entertainment/telugu-cinema/nag-ashwin-asks-anand-mahindra-s-support-to-build-futuristic-vehicles-for-his-prabhasstarrer-101646389522586-amp.html?utm_campaign=fullarticle&utm_medium=referral&utm_source=example ">Hindustan
Times</a></div>
</div>
</div>
In this example, the div with class: "news-card-image" contains one inline style, which I want. if i can get this whole div as a string then also fine, I will manipulate the string and extract the url of backgroun image.
That would be:
$('.news-card-image').attr('style')
To get the url:
$('.news-card-image').attr('style').match(/'(.*)'/)[1]

Selenium can't find ninth element - python

I have a problem with Selenium webdriver.
I want to log in a website and collect some articles from there. I could log in the website with my code, but couldn't find all elements.
This code can find all elements except ninth element of 'major' and 'notice'. (I don't know why but it could find ninth element of 'upload')
from selenium import webdriver
import MyCode
Data = []
....
driver = webdriver.Chrome()
driver.get(MyCode.url[0])
driver.implicitly_wait(10)
major = driver.find_elements_by_class_name('board-lecture-title')
notice = driver.find_elements_by_xpath('//*[#class=\'post-title\']/*')
upload = driver.find_elements_by_class_name('post-date')
....
driver.close()
This is a part of HTML code of the website
<li class="isnotice" style="width:calc(100% - 20px) !important;">
<span class="post-title">
<a href="https://url">
<span class="board-lecture-title">[Course]</span>Title
</a>
</span>
<br>
<span class="post-date">2020년 7월 30일, 목요일, 오전 10:58</span>
<span class="post-viewinfo area-right">
0
<br>
<span>View</span>
</span>
</li>
<li class="isnotice" style="width:calc(100% - 20px) !important;">
<span class="post-title">
<a href="https://url">
<span class="board-lecture-title">[Course]</span>Title
</a>
</span>
<br>
<span class="post-date">2020년 7월 15일, 수요일, 오후 12:20</span>
<span class="post-viewinfo area-right">
0
<br>
<span>View</span>
</span>
</li>
<li class="isnotice" style="width:calc(100% - 20px) !important;">
<span class="post-title">
<a href="https://url">
<span class="board-lecture-title">[Course]</span>Title
</a>
</span>
<br>
<span class="post-date">2020년 6월 29일, 월요일, 오전 11:18</span>
<span class="post-viewinfo area-right">
47
<br>
<span>View</span>
</span>
....
</ul>
I'm sorry for my poor english give you confusion.

BeautifulSoup .find() capturing too much text (how do I narrow it down?)

wondering how to target the "Switch" text on the below html:
<div class="product_title">
<a href="/game/pc/into-the-breach" class="hover_none">
<h1>Into the Breach</h1>
</a>
<span class="platform">
<a href="/game/pc">
PC
</a>
</span>
</div>
<div class="product_data">
<ul class="summary_details">
<li class="summary_detail publisher" >
<span class="label">Publisher:</span>
<span class="data">
<a href="/company/subset-games" >
Subset Games
</a>
</span>
</li>
<li class="summary_detail release_data">
<span class="label">Release Date:</span>
<span class="data" >Feb 27, 2018</span>
</li>
<li class="summary_detail product_platforms">
<span class="label">Also On:</span>
<span class="data">
Switch </span>
</li>
</ul>
</div>
so far I am capturing the "Also On:" text as well (with a lot of spaces) with this code:
self.playable_on_systems_label.setText(self.html_soup.find("span", class_='platform').text.strip() + ', ' + self.html_soup.find("li", class_='summary_detail product_platforms').text.strip())
how do I capture (in this case) only the "Switch" text?
FYI - for the first half of the statement (capturing the "PC") text works fine just not the "also on" text
Thanks in advance,
Your query is getting the entire span element with class="summary_detail product_platforms", which is going to include all the text starting from "Also On:" until "Switch." Try something like .find('a', href=re.compile("^.+switch.+$")) or alternately (using CSS) .select("a[href*=switch]") (solution from here)
you can use BeautifulSoup select() function to navigate the the "Switch" text, check this code!!!
rom bs4 import BeautifulSoup
html = '''<div class="product_title">
<a class="hover_none" href="/game/pc/into-the-breach">
<h1>Into the Breach</h1>
</a>
<span class="platform">
<a href="/game/pc">
PC
</a>
</span>
</div>
<div class="product_data">
<ul class="summary_details">
<li class="summary_detail publisher">
<span class="label">Publisher:</span>
<span class="data">
<a href="/company/subset-games">
Subset Games
</a>
</span>
</li>
<li class="summary_detail release_data">
<span class="label">Release Date:</span>
<span class="data">Feb 27, 2018</span>
</li>
<li class="summary_detail product_platforms">
<span class="label">Also On:</span>
<span class="data">
<a class="hover_none" href="/game/switch/into-the-breach">Switch</a> </span>
</li>
</ul>
</div>'''
soup = BeautifulSoup(html, 'html.parser')
text = soup.select('.summary_detail.product_platforms .hover_none')[0].text.strip()
print(text)
Output:
Switch

My schema markup Rentalcarreservation not works when I receive at my gmail

I attach this html markup code with http://schema.org/RentalCarReservation to my email template when a customer make a booking online.
I validate this markup at https://www.google.com/webmasters/markup-tester/
and not returns any validation error. You can try it.
<div itemscope="" itemtype="http://schema.org/RentalCarReservation" style="display:none"><span itemprop="reservationNumber">161129-125729</span> a
<div itemprop="underName" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name">Fran Deve</span></div>
<div itemprop="reservationFor" itemscope="" itemtype="http://schema.org/RentalCar"><span itemprop="name">Fiat 500</span> <span itemprop="model">500</span>
<div itemprop="brand" itemscope="" itemtype="http://schema.org/Brand"><span itemprop="name">Fiat</span></div>
<div itemprop="rentalCompany" itemscope="" itemtype="http://schema.org/Organization"><span itemprop="name">Centauro Rent a Car</span></div>
</div>
<div itemprop="pickupLocation" itemscope="" itemtype="http://schema.org/Place"><span itemprop="name">Centauro Rent a Car Barcelona - Aeropuerto</span>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"><span itemprop="addressLocality">Barcelona - Aeropuerto</span></div>
</div>
<span itemprop="pickupTime">2017-01-12T09:00:00.000Z</span>
<div itemprop="dropoffLocation" itemscope="" itemtype="http://schema.org/Place"><span itemprop="name">Centauro Rent a Car Barcelona - Aeropuerto</span>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"><span itemprop="addressLocality">Barcelona - Aeropuerto</span></div>
</div>
<span itemprop="dropoffTime">2017-01-19T09:00:00.000Z</span>
Then I open my gmail or google now and nothing happens. I make sure that have my Google Calendar settings with "Events from Gmail" with "add automaticly" checked.

How to fill and submit form using Python 3 and only Python 3 libraries

I am working on this as a free time project.
I would like to use Python 3 to login to a site (fill form and submit) and then I plan to scrape the page for some data. The reason I am strictly looking for a solution in Python 3 is because I am trying to learn more about Python and figured I would go straight to Python 3. I have seen several great looking tools such as mechanize but they only seem to support Python 2.
Planning to use this for a financial investment site but let's just use starbucks as an example.
def loginToStockSite(username, pwd):
url = "https://www.starbucks.com/account/signin"
values = {"Account.UserName" : username,
"Account.PassWord" : pwd}
data = urllib.parse.urlencode(values)
data = data.encode('utf-8')
req = urllib.request.Request(url, data)
sock = urllib.request.urlopen(req)
htmlSource = sock.read().decode('utf-8')
return htmlSource
I have gotten very confused from the various encode, decode, url opener, etc. examples. I have not found a solution that has worked for me yet.
Thanks in advance for any help with my "for fun" project.
Update
Here is the html I get back (with a bunch cut out to fit the character limit for a question)
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>Account Sign In | Starbucks Coffee Company</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<div class="fields">
<div class="region size1of1">
<div class="validation_summary warning validation_medium"><h2>Please Enable Cookies to Continue</h2><p>To sign in to the Starbucks web site, please enable cookies in your web browser.</p></div>
<div class="fields">
<form action="/account/signin" class="siren region size1of2" id="accountForm" method="post">
<fieldset class="login_position">
<legend class="hidden_visually">I have a Starbucks account.</legend>
<h2 class="existing_acc_h3">I have a Starbucks account.</h2>
<div id="user_info" class="region size1of2 reset">
Hi,
<span id="info_user"></span>
</div>
<div class="size1of2">
<a id="not_me" href="#notme">Not You?</a>
</div>
</div>
</div>
</div>
<div id="connect_cont" >
<div id="text_cont" class="hidden">
<h3>Have a Starbucks account?</h3>
<p>Connect your Facebook account to your Starbucks account by logging in here.</p>
</div>
</div>
</li>
<li>
<label for="Account_UserName">Username <span class="required">*</span></label>
<label for="Account_UserName" class="hidden">Starbucks Username <span class="required">*</span></label>
<input class="field_xlarge" id="Account_UserName" maxlength="200" name="Account.UserName" type="text" value="MY_USERNAME_WAS_HERE" />
</li>
<li>
<label for="Account_PassWord">Password <span class="required">*</span></label>
<label for="Account_PassWord" class="hidden">Starbucks Password <span class="required">*</span></label>
<input class="field_xlarge password" id="Account_PassWord" maxlength="200" name="Account.PassWord" type="password" value="MY_PASSWORD_WAS_HERE" />
</li>
<li>
Forgot your username or password?
<p class="privacy_policy hidden">
Concerned about privacy?
</p>
</li>
<li class="inline push">
<input type="checkbox" id="Account.IsRememberMe" name="Account.IsRememberMe" value="True" class="checkbox" />
<label for="Account.IsRememberMe">Keep me signed in.</label>
</li>
</ol>
</fieldset>
<fieldset>
<input id="ReturnUrl" name="ReturnUrl" type="hidden" value="" />
<input id="AllowGuest" name="AllowGuest" type="hidden" value="False" />
<input id="isJavaScriptDisabled" name="isJavaScriptDisabled" type="hidden" value="True" />
<span class="button"><button type="submit">Sign In</button></span>
</fieldset>
<fieldset class="submit">
<div id="fb_container">
<div id="fb_btn_cont">
Or log in using Facebook.
<p><a class="fb_button fb_button_medium" id="connect" href="#connect"><span class="fb_button_text">Login with Facebook</span></a></p>
</div>
</div>
</fieldset>
</form>
<div class="region size1of2 block_login">
<h2>I need a Starbucks account.</h2>
<p><span class="button">Create An Account</span></p>
<p>With a Starbucks account you can register and manage your Starbucks Cards and participate in My Starbucks Rewards.</p>
<ul class ="basic">
<li>Enjoy a free drink on your birthday</li>
<li>Protect your balance if your Starbucks Card is missing or stolen.</li>
<li>Transfer money between cards.</li>
<li>Track your earnings in My Starbucks Rewards</li>
<li>Reload your Card balance automatically</li>
</ul>
</div>
</div>
<div class="fields">
<div class="region size1of1">
<ul id="breadcrumb">
<li>Card .<ul>
<li>My Starbucks Rewards .<ul>
<li>View Your Stars</li>
</ul></li>
</ul></li>
</ul>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<form id="search" method="get" action="/search">
<fieldset>
<input id="searchbox" name="keywords" title="Search Keyword" maxlength="100" class="search_input" />
<span class="button button_search"><button id="submit_search_util" type="submit">Search</button></span>
</fieldset>
</form>
<div class="fields">
<div class="region size5of6 suffix1of6">
<div class="footer_categorical"><ol class="blocks blocks-five-up">
<li><h4>
Buy a Card
</h4>
</li>
<li><h4>
Manage Your Card
</h4>
<ol>
<li>Check Balance</li>
<li>Reload Your Card</li>
<li>Transfer Funds</li>
<li>View Transactions</li>
</ol>
</li>
<li><h4>
My Starbucks Rewards
</h4>
<ol>
<li>Register Your Card</li>
<li>View Your Stars</li>
<li>Keep Your Gold Benefits</li>
<li>Rewards Program Terms and Conditions</li>
</ol>
</li>
<li><h4>
Learn More
</h4>
<ol>
<li>Card Terms and Conditions</li>
<li>What is a Starbucks Card eGift?</li>
<li>Card FAQs</li>
<li>Manage Your Account</li>
<li>My Starbucks Idea</li>
</ol>
</li>
I expected to get back a page like I get when I login in using a browser and have a div with the current balance on whatever the default gift card is that is registered.
<div class="balance-amount numbers">
That is the div that is visible. I found the balance in another place in the page source also but I do not see it on the page.
<p class="card_balance numbers">
<span>$27.68</span> <span class="datestamp">3/10/2013 2:12 PM</span>
</p>
Anyways, I would like to input the login info and submit the form using Python 3 or post the data somehow to login and then (as a use case but outside what is needed to answer the question) I would pull the account balance from the html.
I did find that my username and password are apparently in their corresponding fields and in the validation summary it says
<div class="validation_summary warning validation_medium"><h2>Please Enable Cookies to Continue</h2><p>To sign in to the Starbucks web site, please enable cookies in your web browser.</p></div>
I did see some examples that dealt with cookies. Is that the problem? I will research that possible solution. In the meantime, hope this helps you help me. Thanks.

Resources