0
Hello,
I am wanting to create a Bot to enter a website and search if that site has an email to contact and create an email list ... the problem is that this can all be very generic.. on some site may be in an id, on another may be in class ... I thought I would try to read all the HTML elements of the site and check if it has text with "@" and ". COM" to characterize as an email ... however I’m coming from VBA to python and I’m still catching ... in the documentation of Selenium it shows an example that searches a word inside the page, but when I turn it from error in the import of "PAGE"... someone could help me with a code to read all HTML elements and look for a word or help me solve this import Page issue, because searching Google I found nothing if this page is already installed in Selenium or if I have to install, which PIP INSTALL I have to use and etc ...
import unittest
from selenium import webdriver
import page
class PythonOrgSearch(unittest.TestCase):
"""A sample test class to show how page object works"""
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.get("http://www.python.org")
def test_search_in_python_org(self):
"""
Tests python.org search feature. Searches for the word "pycon" then verified that some results show up.
Note that it does not look for any particular text in search results page. This test verifies that
the results were not empty.
"""
#Load the main page. In this case the home page of Python.org.
main_page = page.MainPage(self.driver)
#Checks if the word "Python" is in title
assert main_page.is_title_matches(), "python.org title doesn't match."
#Sets the text of search textbox to "pycon"
main_page.search_text_element = "pycon"
main_page.click_go_button()
search_results_page = page.SearchResultsPage(self.driver)
#Verifies that the results page is not empty
assert search_results_page.is_results_found(), "No results found."
def tearDown(self):
self.driver.close()
if __name__ == "__main__":
unittest.main()
It Worked Perfectly ... Thank You Very Much !
– Breno Toledo