// Example POST method implementation:
async function postData(url = '', data = {}) {
// Default options are marked with *
const response = await fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json'
// 'Content-Type': 'application/x-www-form-urlencoded',
},
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
body: JSON.stringify(data) // body data type must match "Content-Type" header
});
return response.json(); // parses JSON response into native JavaScript objects
}
postData('https://example.com/answer', { answer: 42 })
.then(data => {
console.log(data); // JSON data parsed by `data.json()` call
});
/* Настройки IP адреса */
IPAddress local_ip(192,168,1,1); // вставьте белый адрес, На самом деле не стоит
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,255,0);
document.getElementsByName("answer")[0].value = data;
If you want to run through large arrays don't use count() function in the loops , its a over head in performance, copy the count() value into a variable and use that value in loops for a better performance.
Eg:
// Bad approach
for($i=0;$i<count($some_arr);$i++)
{
// calculations
}
// Good approach
$arr_length = count($some_arr);
for($i=0;$i<$arr_length;$i++)
{
// calculations
}
<?php
class CountOfMethods implements Countable
{
private function someMethod()
{
}
public function count(): int
{
return count(get_class_methods($this));
}
}
$obj = new CountOfMethods();
var_dump(count($obj));
?>
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument("--start-maximized")
driver = webdriver.Chrome(chrome_options=options,executable_path='D:/Java/TestChrome/lib/chromedriver.exe')
driver.get("https://www.zoom.com.br/ar-condicionado/todos")
wait = WebDriverWait(driver, 20)
stores = wait.until(EC.presence_of_all_elements_located((By.XPATH,'//span[@class="storeCount-txt"]')))
print("test : " + stores[0].get_attribute('innerText'))