default_downloads_dir = getenv('USERPROFILE' if getenv('OS') == 'NT' else 'HOME') + '/' + 'Downloads'
chromedriver_path = default_downloads_dir + '/' + ('chromedriver.exe' if getenv('OS') == 'NT' else 'chromedriver')
options = Options()
driver = webdriver.Chrome(chromedriver_path, chrome_options = options)
url = 'https://www.w3schools.com/css/tryit.asp?filename=trycss_before'
driver.get(url)
frame_css = 'div#iframewrapper iframe[name="iframeResult"]'
frame_element = driver.find_element_by_css_selector(frame_css)
print(frame_element.get_attribute('outerHTML'))
driver.switch_to.frame(frame_element)
element_xpath = '//h1'
element = driver.find_element_by_xpath(element_xpath)
print( element.get_attribute('innerHTML'))
driver.implicitly_wait(10)
script = 'return window.getComputedStyle(arguments[0],":before")'
data = driver.execute_script(script, element)
print('Result(raw) : {}'.format(data))
for data_key in data:
print('element: {}'.format(data_key))
script = 'return window.getComputedStyle(arguments[0],":before").getPropertyValue(arguments[1]);'
for property_key in ['top', 'left', 'width', 'height', 'content']:
property_value = driver.execute_script(script, element, property_key)
print('element property {} = {}'.format(property_key, property_value))
driver.switch_to.default_content()
driver.close()
driver.quit()
element property top = auto
element property left = auto
element property width = auto
element property height = auto
element property content = url("https://www.w3schools.com/css/smiley.gif")
networks:
- my-network
networks:
my-network:
external: true
[String]$username = "[username]"
[String]$outfile = "[output_file_path]"
$path = Get-ChildItem "." -Recurse
Foreach( $file in $path ) {
$f = Get-Acl $file.FullName
if( $f.Owner -eq $username ) {
Write-Host( "{0}"-f $file.FullName | Out-File `
-Encoding "UTF8" `
-FilePath $outfile -Append)
}
}
driver.getPageSource
никогда не будет содержать ничего что этот JavaSrcipt нагенерил - печально но это так.простой пример:
при помощи
driver.getPageSource
время которое эта страничка показывает никогда не узнаете