{"id":23952331,"url":"https://github.com/arthurlunkes/desafios_selenium","last_synced_at":"2026-05-10T02:10:30.385Z","repository":{"id":166239791,"uuid":"641709545","full_name":"arthurlunkes/Desafios_Selenium","owner":"arthurlunkes","description":"Desafios utilizando selenium propostos na aula de mineração de dados.","archived":false,"fork":false,"pushed_at":"2023-05-17T02:46:28.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T09:43:05.832Z","etag":null,"topics":["automation","python","selenium","selenium-webdriver"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arthurlunkes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-17T02:25:32.000Z","updated_at":"2023-05-17T02:43:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"6436311a-b157-4bfc-8c6a-bfe6e3983698","html_url":"https://github.com/arthurlunkes/Desafios_Selenium","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arthurlunkes/Desafios_Selenium","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurlunkes%2FDesafios_Selenium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurlunkes%2FDesafios_Selenium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurlunkes%2FDesafios_Selenium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurlunkes%2FDesafios_Selenium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arthurlunkes","download_url":"https://codeload.github.com/arthurlunkes/Desafios_Selenium/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurlunkes%2FDesafios_Selenium/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260606476,"owners_count":23035351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","python","selenium","selenium-webdriver"],"created_at":"2025-01-06T13:54:20.503Z","updated_at":"2026-05-10T02:10:30.378Z","avatar_url":"https://github.com/arthurlunkes.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Desafios Selenium\n\n\u003cdiv align=\"center\"\u003e\u003ch2\u003eAcadêmico: Arthur Lunkes\u003c/h2\u003e\u003c/div\u003e\n\n## Descrição\n  Desafios utilizando selenium propostos na aula de mineração de dados.\n\n\u003cdiv align=\"center\"\u003e\u003ch2\u003eExercícios\u003c/h2\u003e\u003c/div\u003e\n\n### 01-) Monte um script para acessar o curso de sistemas e para preencher o formulário.\n  Resposta:\n\n```python\n\nfrom time import sleep\nfrom selenium import webdriver\n\ndrive = webdriver.Chrome(executable_path='./chromedriver')\n\ndrive.get(\"https://www.google.com.br/\")\n\npesquisar = drive.find_element_by_name(\"q\")\npesquisar.send_keys(\"UNIMATER\")\npesquisar.submit()\n\nsleep(2)\nclick = drive.find_element_by_css_selector('#rso \u003e div:nth-child(1) \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div.yuRUbf \u003e a \u003e h3')\nclick.click()\n\nsleep(2)\ncurso = drive.find_element_by_xpath('/html/body/form/div[3]/main/article[1]/div/section/div[2]/a[8]')\ncurso.click()\n\nsleep(4)\nnome = 'Arthur Lunkes'\nemail = 'arthur.lunkes2017@gmail.com'\ntelefone = '(46)99110-0092'\nmsg = 'Aqui é o Arthur'\n\nform_nome = drive.find_element_by_xpath('//*[@id=\"txtNome\"]')\nform_nome.click()\nform_nome.send_keys(nome)\n\nform_email = drive.find_element_by_xpath('//*[@id=\"txtEmail\"]')\nform_email.click()\nform_email.send_keys(email)\n\nform_telefone = drive.find_element_by_xpath('//*[@id=\"txtTelefone\"]')\nform_telefone.click()\nform_telefone.send_keys(telefone)\n\nform_mensagem = drive.find_element_by_xpath('//*[@id=\"txtMensagem\"]')\nform_mensagem.click()\nform_mensagem.send_keys(msg)\n\n```\n\n### 02-) Agora crie um script para assistir a palavra do coordenador (Vídeo do Youtube). Para interagir com o conteúdo do \\\u003ciframe\\\u003e (neste caso, o vídeo do YouTube) usando o  Selenium, é preciso mudar para o contexto do \\\u003ciframe\\\u003e.\n  Resposta:\n\n```python\n\nfrom time import sleep\nfrom selenium import webdriver\n\ndriver = webdriver.Chrome(executable_path= \"./chromedriver\")\n\ndriver.get(\"https://www.google.com.br/\")\n\npesquisar = driver.find_element_by_name(\"q\")\npesquisar.send_keys(\"UNIMATER\")\npesquisar.submit()\n\nsleep(2)\nsite_unimater = driver.find_element_by_css_selector('#rso \u003e div:nth-child(1) \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div.yuRUbf \u003e a \u003e h3')\nsite_unimater.click()\n\nsleep(4)\ncurso = driver.find_element_by_xpath('/html/body/form/div[3]/main/article[1]/div/section/div[2]/a[8]')\ncurso.click()\n\nsleep(4)\niframe = driver.find_element_by_css_selector('#palavradocoordenador \u003e p.palavra-coordenador-wrapper \u003e iframe')\ndriver.switch_to.frame(iframe)\n\nbotao_play = driver.find_element_by_xpath('/html/body/div/div/div[4]/button')\nbotao_play.click()\n\n```\n\n### 03-) Agora crie um script para acessar seu portal do aluno.\n  Resposta:\n\n```python\n\nfrom time import sleep\nfrom selenium import webdriver\n\ndrive = webdriver.Chrome(executable_path= './chromedriver')\n\ndrive.get(\"https://www.google.com.br/\")\n\npesquisar = drive.find_element_by_name(\"q\")\npesquisar.send_keys(\"UNIMATER\")\npesquisar.submit()\n\nsleep(2)\nclick = drive.find_element_by_css_selector('#rso \u003e div:nth-child(1) \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div \u003e div.yuRUbf \u003e a \u003e h3')\nclick.click()\n\nsleep(2)\naluno = drive.find_element_by_xpath('/html/body/form/div[3]/header/div[1]/div/nav[1]/a[1]')\naluno.click()\n\nsleep(2)\nprimeira_aba = drive.window_handles[1]\n\ndrive.switch_to.window(primeira_aba)\nprint(\"Nome segunda aba =\" + drive.title)\n\nusuario = 'user'\nsenha = 'password'\n\nsleep(6)\nform_usuario = drive.find_element_by_xpath('/html/body/div/div[2]/div/div[2]/div/form/div[1]/div/input')\nform_usuario.click()\nform_usuario.send_keys(usuario)\n\nform_senha = drive.find_element_by_xpath('/html/body/div/div[2]/div/div[2]/div/form/div[2]/div[1]/input')\nform_senha.click()\nform_senha.send_keys(senha)\n\nacessar = drive.find_element_by_xpath('//*[@id=\"btn-login\"]')\nacessar.click()\n\n```\n\n### 04-) Utilize o Selenium para baixar o arquivo CSV de toda a série histórica, ou seja, de  todo o período – desde começo – até o dia atual, das ações das Americanas - AMER3.SA.\n  Resposta:\n\n```python\n\nfrom time import sleep\nfrom selenium import webdriver\n\ndriver = webdriver.Chrome(executable_path= './chromedriver')\n\ndriver.get('https://finance.yahoo.com/quote/AMER3.SA/history?p=AMER3.SA')\n\nselecionar_data = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/div/div/section/div[1]/div[1]/div[1]/div/div/div')\nselecionar_data.click()\n\nselecionar_data_max = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/div/div/section/div[1]/div[1]/div[1]/div/div/div[2]/div/ul[2]/li[4]/button')\nselecionar_data_max.click()\n\nfazer_download = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/div/div/section/div[1]/div[2]/span[2]/a')\nfazer_download.click()\n\n```\n\n\u003cdiv align=\"center\"\u003e\u003ch2\u003eDesafio\u003c/h2\u003e\u003c/div\u003e\n\n### 05-) Utilize o Selenium para baixar o arquivo CSV de toda a série histórica, ou seja, de  todo o período – desde começo – até o dia atual\n  Para todas as empresas do setor de varejo:\n\n- AMER3.SA (Americanas)\n- MGLU3.SA (Magazine)\n- VIIA3.SA (Via - Casa Bahia, Ponto Frio)\n- ALPA4.SA (Havaianas, Dupé)\n- ARZZ3.SA (Arezzo, AnaCapri)\n- CEAB3.SA (Abril Capital)\n- SFBG3.SA (Centauro)\n- GUAR3.SA (Riachuelo e Midway)\n- SOMA3.SA (Hering)\n- LREN3.SA (Renner)\n- AMAR3.SA (Marisa)\n- TFCO4.SA (Track Field)\n- LJQQ3.SA (Quero-Quero)\n- MBLY3.SA (Megastore)\n- NTCO3.SA (Natura)\n- PGMN3.SA (Petz)\n- RADL3.SA (Raia)\n- WEST3.SA  (Westwing)\n  Resposta:\n\n```python\n\nfrom time import sleep\nfrom selenium import webdriver\n\ndriver = webdriver.Chrome(executable_path= './chromedriver')\n\nlojas = ['AMER3.SA', 'MGLU3.SA', 'VIIA3.SA', 'ALPA4.SA',\n         'ARZZ3.SA', 'CEAB3.SA', 'SFBG3.SA', 'GUAR3.SA',\n         'SOMA3.SA', 'LREN3.SA', 'AMAR3.SA', 'TFCO4.SA',\n         'LJQQ3.SA', 'MBLY3.SA', 'NTCO3.SA', 'PGMN3.SA',\n         'RADL3.SA', 'WEST3.SA']\n\nfor loja in lojas:\n    site = f'https://finance.yahoo.com/quote/{loja}/history?p={loja}'\n    driver.get(site)\n\n    sleep(2)\n    selecionar_data = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/div/div/section/div[1]/div[1]/div[1]/div/div/div')\n    selecionar_data.click()\n\n    sleep(2)\n    selecionar_data_max = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/div/div/section/div[1]/div[1]/div[1]/div/div/div[2]/div/ul[2]/li[4]/button')\n    selecionar_data_max.click()\n\n    sleep(2)\n    fazer_download = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/div/div/section/div[1]/div[2]/span[2]/a')\n    fazer_download.click()\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurlunkes%2Fdesafios_selenium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurlunkes%2Fdesafios_selenium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurlunkes%2Fdesafios_selenium/lists"}