Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Sunday, 19 March 2017

[TIPS] 視窗跑到螢幕的最邊邊如何弄回來

因為我做事時都有多個螢幕,在公司有三個而在家裡有兩個,所以有時候會發現某個程式的視窗「不見了」,用滑鼠去讓它放大縮小時,又可以看到一點點,其實它就在螢幕的上下左右一邊的邊邊上,但是怎麼弄都移動不了......




所以這樣做

方法A:利用鍵盤來達成使命吧。


a. 確認這個視窗是在最上層
(直接在工具列上該視窗的檔案名稱點一下就可以)

b. 按下鍵盤的Alt + 空白鍵 (最有用的)

c. 在視窗邊邊(看你的視窗是躲在上下左右哪一邊)會出現一條工作框,這時用鍵盤的上下鍵或滑鼠去點「移動」

d. 然後就可以用鍵盤的上下左右鍵來移動視窗,這個死都不出來的視窗,終於出現了 XD



方法B:用滑鼠+鍵盤來完成目的。

a. 直接在工具列上該視窗的檔案名稱用滑鼠按下右鍵

b. 出現一條工作框,這時用滑鼠去點「移動」

c. 然後就可以用鍵盤的上下左右鍵來移動視窗了

Thursday, 2 March 2017

[Selenium]how to run your test in Chrome


[Selenium]how to run your test in Chrome 



1. Download following driver 

Chrome:https://sites.google.com/a/chromium.org/chromedriver/downloads
Edge:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox:https://github.com/mozilla/geckodriver/releases
Safari:https://webkit.org/blog/6900/webdriver-support-in-safari-10/


2. Unzip driver and put it into a folder. 
      
3. Load your driver in your code. 
    I want to open Chrome browser so I set the path up in my code. 

       
   from selenium import webdriver
   url="C:\\Programs\\Python36\\BrowersDriver\\chromedriver.exe"
   driver=webdriver.Chrome(url)
   driver.get("http://www.yahoo.com")
   driver.close()
   driver.quit()

how to install geckodriver on a windows system


how to install geckodriver on a windows system

Answer: You can put it anywhere. 


1. Download following driver 

Chrome:https://sites.google.com/a/chromium.org/chromedriver/downloads
Edge:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox:https://github.com/mozilla/geckodriver/releases
Safari:https://webkit.org/blog/6900/webdriver-support-in-safari-10/


2. Unzip driver and put it into a folder. 
      
3. Load your driver in your code. 
    I want to open Chrome browser so I set the path up in my code. 

       
   from selenium import webdriver
   url="C:\\Programs\\Python36\\BrowersDriver\\chromedriver.exe"
   driver=webdriver.Chrome(url)
   driver.get("http://www.yahoo.com")
   driver.close()
   driver.quit()


Selenium: Firefox Profile exception Can't load the profile

I use python to open firefox and redirect to google page but it show empty page and get error. 
This is the Panel constructor:


Traceback (most recent call last):
  File "C:/Users/KennethHu/PycharmProjects/Web_Automation/Hello Selenium.py", line 3, in 
    driver=webdriver.Firefox()
  File "C:\Programs\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__
    self.binary, timeout)
  File "C:\Programs\Python36\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "C:\Programs\Python36\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "C:\Programs\Python36\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 108, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: C:\Users\KENNET~1\AppData\Local\Temp\tmp2rghen87 If you specified a log_file in the FirefoxBinary constructor, check it for details.


Solution: 

elenium team fixed in latest version. For almost all environments the fix is:
pip install -U selenium
Unclear at which version it was fixed (apparently r13122), but certainly by 2.26.0 (current at time of update) it is fixed.

You may get Failure like this Failure to observe this step will give you an error 
selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH.

Download following driver into your project folder. 

Chrome:https://sites.google.com/a/chromium.org/chromedriver/downloads
Edge:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox:https://github.com/mozilla/geckodriver/releases
Safari:https://webkit.org/blog/6900/webdriver-support-in-safari-10/

Wednesday, 1 March 2017

Upgrade to the Latest Revision of MongoDB in windows

Upgrade to the Latest Revision of MongoDB in windows

First, My mongodb is very simple- single DB so I just follow the instruction -

https://docs.mongodb.com/manual/tutorial/upgrade-revision/  -
Replace the Existing Binaries

  1. Download the binaries for the latest MongoDB revision from the MongoDB Download Page and store the binaries in a temporary location. The binaries download as compressed files that uncompress to the directory structure used by the MongoDB installation.
  2. Shutdown the instance.
  3. Replace the existing MongoDB binaries with the downloaded binaries.
  4. Restart the instance.

My steps :
          1. I download the latest revision of MongoDB -3.4. 
          2. Install MongoDB 3.4 
      3. change path
          3.1 control panel
          3.2 System --> Change settings
          3.3 Advanced --> Environment Variables...
          3.4 System Variables -->[Path]
       


         3.5. change MongoDB path from 3.0 to .3.4 and then save. 
         

         3.6 open command prompt (cmd) and check version --- Mongod -version

how-to-recursively-create-subfolder-in-each-folder-of-a-directory-in-cmd

test.cmd: @echo off setlocal for /f "usebackq tokens=*" %%a in (`dir /b /a:d`) do ( rem enter the directory pushd %%a echo...