[英]Get injected javascript from a website when testing with Selenium / Protractor
我正在使用 Selenium / Protractor 来测试我的应用程序的 UI 和 html。 我有一个注入站点的<script type="application/ld+json">
,我想获取这个脚本标签的内容,以便可以将它用于一些测试。
脚本示例如下:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "LocalBusiness",
"name": "The Best Company Name",
"image": "https://www.urltowebsite.us/WebContent/Images/Dealer/6/Logo.png?preset=Dealer.Logo",
"address": {
"@type": "PostalAddress",
"streetAddress": "19 North Suite 2 ",
"addressLocality": "Mobile",
"addressRegion": "MS",
"postalCode": "39107",
"addressCountry": "USA"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": "32.351923",
"longitude": "-88.73434"
},
"openingHoursSpecification": [{
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Monday"
],
"opens": "07:30:00",
"closes": "17:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Tuesday"
],
"opens": "07:30:00",
"closes": "17:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Wednesday"
],
"opens": "07:30:00",
"closes": "12:00:00"
}
]
}
</script>
我正在使用 Selenium / Protractor 来测试我的应用程序的 UI 和 html。 我有一个注入站点的<script type="application/ld+json">
,我想获取这个脚本标签的内容,以便可以将它用于一些测试。
脚本示例如下:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "LocalBusiness",
"name": "The Best Company Name",
"image": "https://www.urltowebsite.us/WebContent/Images/Dealer/6/Logo.png?preset=Dealer.Logo",
"address": {
"@type": "PostalAddress",
"streetAddress": "19 North Suite 2 ",
"addressLocality": "Mobile",
"addressRegion": "MS",
"postalCode": "39107",
"addressCountry": "USA"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": "32.351923",
"longitude": "-88.73434"
},
"openingHoursSpecification": [{
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Monday"
],
"opens": "07:30:00",
"closes": "17:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Tuesday"
],
"opens": "07:30:00",
"closes": "17:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Wednesday"
],
"opens": "07:30:00",
"closes": "12:00:00"
}
]
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.