selenium 内嵌窗口定位滚动

Selenium 配合 Chromedriver 爬取艺龙评价时,存在内嵌窗口,直接 JS 无法滚动,这里使用如下操作方法

if spider.name == 'elong':
	for i in range(2):
		rand = random.uniform(1, 4)
		time.sleep(rand)
		drag = self.driver.find_element_by_xpath("//li[@class='s_bdt'][last()-1]")
		self.driver.execute_script("arguments[0].scrollIntoView();", drag)
		time.sleep(2)
else:
	for i in range(2):
		rand = random.uniform(1, 4)
		time.sleep(rand)
		js = "window.scrollTo(0,document.body.scrollHeight)"
		self.driver.execute_script(js)
print('Chrome driver success...')

N个数字可重复的排列组合 PHP

商品有三种价格 8,59,68,卖出不多于10件商品,可以卖出多少种方式

<?php
$a = [8,59,68];
function getList($array,$count,$index = 0,$up =0)
{
    static $result = [];
	for ($i=$index; $i < $count; $i++) {
	    foreach($array as $k => $v){
            $value = $up?$up.'+'.$v:$v;
            $result[]  = $value;
            getList($array,$count,$i+1,$value);
	    }    	
    }
    return $result ;
	
}
var_export(getList($a,10));

结果是 3^10 次方种