from os import getenv
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as Opt
opts = Opt()
if getenv('OS') != None :
p = getenv('HOMEDIR').replace('\\', '/')
else:
p = getenv('HOME')
opts.add_argument('--user-data-dir='+p)
Type "help", "copyright", "credits" or "license" for more information.
>>> from os import getenv
if getenv('OS') != None :
getenv('HOMEDIR')
# \Users\Serguei
else :
getenv('HOME')
# /home/sergueik
wrong file structure on disk: 1 path: UserData\Default\Code Cache\js
[0122/101624.098:ERROR:cache_util_win.cc(21)] Unable to move the cache: ╤шёЄхьх эх єфрхЄё эрщЄш єърчрээ√щ яєЄ№. (0x3)
(Системе не удается найти указанный путь)
opts.add_argument('--user-data-dir=UserData')
Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9fcbc9baed1 mysql:5.7 "docker-entrypoint.s…" 11 minutes ago
docker exec -it mysql-server mysql -P 3306 -h localhost -uroot -ppassword -e "set @var = '1'; select @var ;"
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
и тишинаdocker exec -it mysql-server mysql -P 3306 -h localhost -uroot -ppassword -e "set @var = '1'; select @var ;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------+
| @var |
+------+
| 1 |
+------+
sed -i 's|\([0-9][0-9][0-9][0-9]\)\-\(01\)\-\([0-9][0-9]\)|\3 Jan \1|' a.txt
sed -i 's|\([0-9][0-9][0-9][0-9]\)\-\(02\)\-\([0-9][0-9]\)|\3 Feb \1|' a.txt
...
и т.д. date --help | grep %c
%c locale's date and time (e.g., Thu Mar 3 23:05:25 2005)
getCoords.js
:var getCoords = function(selector, debug) {
var elem;
try {
elem = document.querySelector(selector);
// elem = document.getElementById(id);
} catch(e) {
}
var t =null;
if (elem != null){
t = elem.getBoundingClientRect();
if (debug) {
alert(JSON.stringify(t));
}
}
return JSON.stringify(t);
}
var selector = arguments[0] || '#text';
var debug = arguments[1];
return getCoords(selector, debug);
private static final String baseURL = "https://www.wikipedia.org/";
private static final String selector = "#searchInput";
// это все не работает пока
// private String baseURL = "https://ya.ru/";
// private String selector = "button.button"
// private String selector = "#text"
@Test(priority = 1, enabled = true)
public void openExtensionURLTest() {
driver.get(baseURL);
WebElement element = wait.until(ExpectedConditions
.visibilityOf(driver.findElement(By.cssSelector(selector))));
assertThat(element, notNullValue());
// на ya.ru даже здесь не бываем
String data = (String) super.executeScript(
super.getScriptContent("getCoords.js"), selector, false);
System.err.println(data);
}
Test Name: openExtensionURLTest
{"x":284.5874938964844,"y":445.82501220703125,"width":394.20001220703125,"height
":43.20000076293945,"top":445.82501220703125,"right":678.7875061035156,"bottom":
489.0250129699707,"left":284.5874938964844}
button.button
{"x":817.5,"y":305.6000061035156,"width":108,"height":46,"top":305.6000061035156
,"right":925.5,"bottom":351.6000061035156,"left":817.5}
"#text"
{"x":125.5,"y":305.6000061035156,"width":692,"height":46,"top":305.6000061035156
,"right":817.5,"bottom":351.6000061035156,"left":125.5}
https://stackoverflow.com/questions/21628904/accep...