Conseguiu entrar no formulario e datepicker
This commit is contained in:
44
test_datepicker2.py
Normal file
44
test_datepicker2.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import asyncio
|
||||
from playwright.async_api import async_playwright
|
||||
import os
|
||||
|
||||
html_content = '''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<input type="text" class="datepicker1">
|
||||
<input type="text" class="datepicker2">
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
|
||||
<script>
|
||||
$('.datepicker1').datepicker();
|
||||
$('.datepicker2').datepicker();
|
||||
$('.datepicker2').datepicker('show'); // show the second one
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
async def main():
|
||||
with open('test2.html', 'w') as f:
|
||||
f.write(html_content)
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch()
|
||||
page = await browser.new_page()
|
||||
await page.goto(f"file://{os.path.abspath('test2.html')}")
|
||||
|
||||
try:
|
||||
dp = page.locator('.datepicker-days')
|
||||
await dp.wait_for(state='visible', timeout=3000)
|
||||
print('WAIT FOR COM SUCESSO')
|
||||
except Exception as e:
|
||||
print(f'ERRO ESPERADO: {type(e).__name__} - {str(e)}')
|
||||
|
||||
await browser.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user