In [94]:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

In [95]:
driver= webdriver.Chrome()
driver.get("http://offcampus.lib.washington.edu/login?url=http://www.webofknowledge.com/WOS")
username=driver.find_element_by_id('weblogin_netid')
username.send_keys("ksakloth")
password=driver.find_element_by_id('weblogin_password')
password.send_keys('Mona123!')
sign_in=driver.find_element_by_name('submit').click()
basic_search=driver.find_element_by_id('searchTypes')
driver.find_element_by_xpath('//*[@id="value(input1)"]').send_keys('nuclear engineering')
WebDriverWait(driver,5).until(EC.presence_of_element_located((By.XPATH,'//*[@id="addSearchRow1"]/span[1]/a')))
driver.find_element_by_xpath('//*[@id="addSearchRow1"]/span[1]/a').click()
//*[@id="select2-chosen-14"]
WebDriverWait(driver,5).until(EC.presence_of_element_located((By.XPATH,'//*[@id="select2-results-14')))
driver.find_element_by_xpath('//*[@id="select2-chosen-14"]').click()


---------------------------------------------------------------------------
TimeoutException                          Traceback (most recent call last)
<ipython-input-95-20f2b21c2496> in <module>()
     10 WebDriverWait(driver,5).until(EC.presence_of_element_located((By.XPATH,'//*[@id="addSearchRow1"]/span[1]/a')))
     11 driver.find_element_by_xpath('//*[@id="addSearchRow1"]/span[1]/a').click()
---> 12 WebDriverWait(driver,5).until(EC.presence_of_element_located((By.XPATH,'//*[@id="select2-results-14')))
     13 driver.find_element_by_xpath('//*[@id="select2-chosen-14"]').click()

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\support\wait.py in until(self, method, message)
     78             if time.time() > end_time:
     79                 break
---> 80         raise TimeoutException(message, screen, stacktrace)
     81 
     82     def until_not(self, method, message=''):

TimeoutException: Message: 

In [82]:


In [83]:


In [84]:


In [85]:


In [86]:


In [87]:


In [88]:


In [89]:


In [90]:


In [ ]:
driver.find_element_by_xpath('//*[@id="select2-chosen-14"]').click()

In [ ]:
Select select = new Select(driver.findElement(By.xpath("//*[@id="select2-chosen-14")));
#select.deselectAll();
select.selectByVisibleText("OR");

In [53]:
driver.find_element_by_xpath('//*[@id="value(input2)"]').send_keys('hot cell')

In [41]:
driver.find_element_by_xpath('//*[@id="addSearchRow2"]/span[1]/a').click()

In [ ]:
#//*[@id="select2-chosen-40"]

In [29]:
driver.find_element_by_xpath('//*[@id="value(input3)"]').send_keys('centrifuge')

In [26]:
driver.find_element_by_xpath('//*[@id="select2-results-14"]').click()


---------------------------------------------------------------------------
ElementNotVisibleException                Traceback (most recent call last)
<ipython-input-26-bd957ec3342e> in <module>()
----> 1 driver.find_element_by_xpath('//*[@id="select2-results-14"]').click()

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\webelement.py in click(self)
     75     def click(self):
     76         """Clicks the element."""
---> 77         self._execute(Command.CLICK_ELEMENT)
     78 
     79     def submit(self):

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\webelement.py in _execute(self, command, params)
    491             params = {}
    492         params['id'] = self._id
--> 493         return self._parent.execute(command, params)
    494 
    495     def find_element(self, by=By.ID, value=None):

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
    247         response = self.command_executor.execute(driver_command, params)
    248         if response:
--> 249             self.error_handler.check_response(response)
    250             response['value'] = self._unwrap_value(
    251                 response.get('value', None))

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
    191         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    192             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 193         raise exception_class(message, screen, stacktrace)
    194 
    195     def _value_or_default(self, obj, key, default):

ElementNotVisibleException: Message: element not visible
  (Session info: chrome=58.0.3029.96)
  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.14393 x86_64)

In [13]:
WebDriverWait wait= new WebDriverWait(driver, 300);
WebElement triggerDropDown = driver.findElement(By
                .xpath("//*[@id="addSearchRow1"]/span[1]/a"));
triggerDropDown.click();
#WebElement selectElement = wait.until(ExpectedConditions
                  #.visibilityOfElementLocated(By.id("formLevel:levels_input")));
#Select select = new Select(selectElement);
#select.selectByVisibleText("SECURITY");


  File "<ipython-input-13-8669f278fe84>", line 1
    WebDriverWait wait= new WebDriverWait(driver, 300);
                     ^
SyntaxError: invalid syntax

In [11]:
driver.find_element_by_xpath('//*[@id="addSearchRow1"]/span[1]/a').click()


---------------------------------------------------------------------------
ElementNotVisibleException                Traceback (most recent call last)
<ipython-input-11-b9d7fd4ef84b> in <module>()
----> 1 driver.find_element_by_xpath('//*[@id="addSearchRow1"]/span[1]/a').click()

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\webelement.py in click(self)
     75     def click(self):
     76         """Clicks the element."""
---> 77         self._execute(Command.CLICK_ELEMENT)
     78 
     79     def submit(self):

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\webelement.py in _execute(self, command, params)
    491             params = {}
    492         params['id'] = self._id
--> 493         return self._parent.execute(command, params)
    494 
    495     def find_element(self, by=By.ID, value=None):

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
    247         response = self.command_executor.execute(driver_command, params)
    248         if response:
--> 249             self.error_handler.check_response(response)
    250             response['value'] = self._unwrap_value(
    251                 response.get('value', None))

C:\Users\ksakl\AppData\Local\Continuum\Miniconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
    191         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    192             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 193         raise exception_class(message, screen, stacktrace)
    194 
    195     def _value_or_default(self, obj, key, default):

ElementNotVisibleException: Message: element not visible
  (Session info: chrome=58.0.3029.96)
  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.14393 x86_64)

In [ ]: