(async () => {
// ...
for(const element of elements) {
const text = await element.findElement(by.xpath('.//span')).getAttribute('innerText');
if(~'Бадминтон'.indexOf(text)) {
console.log(text);
break;
}
}
// ...
})()
Заголовки возвращает адекватные
Access-Control-Allow-Credentials: true
Как быть на чистом js?
var data = "{}";
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.themoviedb.org/3/configuration/countries?api_key=");
xhr.send(data);
<table>
<tr role="row" class="odd">
<td width="10%">1152012985</td>
<td width="13%">22:02:34</td>
<td width="12%"><img src="/images/cur_DOGE.png" width="18px" height="18px"> <span>DOGE</span></td>
<td width="18%"><a class="nick">rijiy</a></td>
<td width="13%">0.006</td>
<td width="11%"><48</td>
<td width="10%">39.8071</td>
<td width="13%" class="green">+0.00600000</td>
</tr>
</table>
document.querySelector('.odd').lastElementChild.classList // ["green", value: "green"]
document.querySelector('.odd').lastElementChild.classList[0] // "green"
;(function ($) {
$(".input").bind("paste", function(evt) {
var item = (evt.clipboardData || evt.originalEvent.clipboardData).items[0] || null;
if (item && item.kind === "file" && item.type.indexOf("image") !== -1) {
var file = item.getAsFile(),
data = new FormData();
data.append('file', file);
$.ajax({
url: "/upload",
type: "POST",
data: data,
contentType: false,
processData: false,
success: function (r) {
// ...
}
})
}
})
})(jQuery)