chrome console 命令简记

时间:2023-03-09 17:14:56
chrome console 命令简记

1、快速迭代元素

$$('tr.dispute-num td strong a').map(function (el) { return el.innerHTML; })

2、复选框选中/取消选中

checks.map(function(check){$(check).prop( "checked", false );})

3、打开多个链接

$x("//table[@id='orderListTable']/tbody/tr/td[1]/table[@class='tableIn']/tbody/tr/td[2]/div/p[1]/a").map(function(link){link.click();})

4、将亚马逊后台业务报告的ASIN,属于自己上传的标记下来

['B01L1CDLR4', 'B01LX8BASZ', 'B01LZ6JWZB', 'B01M0EVDQR', 'B01LZFP6FN', 'B01JZP8BB0', 'B01K1B1BUK'].map(function(asin) {
$($x("//tr[descendant::a[text()='" + asin + "']]")).attr('style', 'background-color:yellow');
})

5、获取当前时间

function strpad00(s) { s = s + ''; if (s.length === 1) s = '0'+s; return s; } var currentdate = new Date(); var datetime = currentdate.getDate() + "/" + strpad00((currentdate.getMonth()+1)) + "/" + currentdate.getFullYear() + " @ " + currentdate.getHours() + ":" + strpad00(currentdate.getMinutes()) + ":" + strpad00(currentdate.getSeconds()); console.log(datetime);

6. 12321信息自动填写

$("input[id='phone']").val('13828863221');

$("input[id='phone']").blur();

$('input:radio[name=bad_type]').filter('[value=1]').prop('checked', true);

function strpad00(s)
{
s = s + '';
if (s.length === 1) s = '0'+s;
return s;
}

var currentdate = new Date();

var date = currentdate.getFullYear()
+ "-" + strpad00((currentdate.getMonth()+1))
+ "-" + currentdate.getDate();

var time = currentdate.getHours() + ":"
+ strpad00(currentdate.getMinutes());

console.log(date);
console.log(time);

$("input[id='d241']").val(date);

$("input[id='d242']").val(time);

$("input[id='d241']").blur();

$("textarea[id='sms_content']").val('金融贷款诈骗,地下钱庄高利贷,电信诈骗');

$("textarea[id='sms_content']").blur();

7、订单快速打开

['B01K1B1BUK', 'B01JZP8BB0', 'B01K1VP372', 'B01LXHSQXQ', 'B01KZXYT5S', 'B01LZFP6FN', 'B01M0EVDQR', 'B01LYKMZE6', 'B01LZ6JWZB', 'B01LX8BASZ', 'B01L1CDLR4', 'B01MEG9XYF', 'B01M5CUELP'].map(
function(asin) {
xpat = "//td[contains(@class, 'order-cell') and descendant::span[text()='" + asin + "']]/a";
$x(xpat).map(function(link) {
window.open(link)
});
})

8、竞价+0.05

$('table#keywordsTable tbody tr').each(function(index, row) {
var amazon_price = $(row).find('td:nth-child(6)').text();
amazon_price = parseFloat(amazon_price.replace(',', '.').replace('€', '').replace('£', '').replace('—', '0'));

var price_input = $(row).find('td:nth-child(7) div div input');
var your_price = price_input.val();
your_price = parseFloat(your_price.replace(',', '.').replace('€', '').replace('£', ''));

var bigger_price = amazon_price;
if (bigger_price < your_price) {
bigger_price = your_price;
}

var set_price = (bigger_price + 0.05).toFixed(2);

console.log('bigger price: ' + bigger_price);
console.log('set price: ' + set_price);

price_input.click();
$('div[class="a-popover cm-editor-popover"]').find('form').find('input[type=text]').val(set_price);
$('div[class="a-popover cm-editor-popover"]').find('form').find('input[type=submit]').click();
});