The Keys class provide keys in the keyboard like RETURN, F1, ALT etc. Currently supported WebDriver implementations are Firefox, Chrome, Ie and Remote. The selenium.webdriver module provides all the WebDriver implementations. With open('available_domain.txt', 'w') as f:Īlmost identical to the code 1 except we're using pyvirtualdisplay and minor changes accordingly.ĭisplay = Display(visible=0, size=(1024, 768))Įlem = browser.find_element_by_name('root') # Find the search boxįor more information about the Selenium for Python, please check: Page_source, available = ready(browser, d) find_element_by_name('root') # Find the search box # (not ok) unanimous = unanimo (not a dic_word) + us # select words that are the dictionary words without suffix If w = d and len(w) >= 6 and len(w) <= LENGTH: With open('domain_out.txt', 'w') as outf: # Finding a combination of words and domain name (.ly. Print "%s yes: check1 = %s no: check2 = %s" %(d, check1, check2) Page_source = (browser.page_source).encode('utf-8') """Looping until the result page should have a string either for check1 or for check2""" While(check1 = False and check2 = False): while is needed for the page randering timeģ. check availability with specific stringsĢ. I'm using Firefox, but there are other choices ( WebDriver API):Ĭode 1 - Browser visible from selenium import webdriverįrom import Keys.But for the first page where Selenium puts in the input, I used time.sleep(). I opted to check if specific strings are there in the page rather than using time.sleep(). So, before we check the availability page (2nd page), the code needs time. It usually takes time for rendering a page.In the code samples listed in later sections, only the domain "ly" is used.Regarding the display: we can make the browser visible or invisible(faster) during the scraping.Only, available names will be written into the file. The result will be written both on the console (I used the sublime). Selenium checks whether there is a certain string that can tell yes or no.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |