{"id":8227,"date":"2024-07-14T15:51:13","date_gmt":"2024-07-14T12:51:13","guid":{"rendered":"https:\/\/sunucucozumleri.com\/?p=8227"},"modified":"2024-07-14T15:51:13","modified_gmt":"2024-07-14T12:51:13","slug":"linuxa-selenium-nasil-kurulur","status":"publish","type":"post","link":"https:\/\/sunucucozumleri.com\/blog\/linuxa-selenium-nasil-kurulur\/","title":{"rendered":"Linux&#8217;a Selenium Nas\u0131l Kurulur?"},"content":{"rendered":"<p>Linux sunucularda bar\u0131nd\u0131r\u0131lan otomasyon testlerini \u00e7al\u0131\u015ft\u0131rmak geri d\u00f6n\u00fc\u015f\u00fc olmayacak \u015fekilde \u015fu soruyu akla getiriyor: <strong>Linux&#8217;a Selenium nas\u0131l kurulur?<\/strong><\/p>\n<h2>Selenium Nedir?<\/h2>\n<p><strong>Selenium<\/strong>, web uygulamalar\u0131n\u0131 otomatikle\u015ftirmek i\u00e7in kullan\u0131lan pop\u00fcler bir ara\u00e7t\u0131r. Bir dizi ara\u00e7 ve k\u00fct\u00fcphaneden olu\u015fur ve taray\u0131c\u0131 tabanl\u0131 uygulamalar\u0131 test etmek ve otomatikle\u015ftirmek i\u00e7in kullan\u0131l\u0131r. \u0130\u015fte Selenium hakk\u0131nda baz\u0131 temel bilgiler:<\/p>\n<ol>\n<li><strong>Selenium WebDriver<\/strong>: Selenium&#8217;un \u00e7ekirdek bile\u015fenidir ve web taray\u0131c\u0131lar\u0131n\u0131 kontrol etmek i\u00e7in kullan\u0131l\u0131r. WebDriver, \u00e7e\u015fitli programlama dilleri (Java, C#, <a href=\"https:\/\/sunucucozumleri.com\/blog\/python-nedir\/\">Python<\/a>, Ruby, JavaScript vb.) ile kullan\u0131labilir ve taray\u0131c\u0131lar aras\u0131 uyumluluk sa\u011flar.<\/li>\n<li><strong>Selenium IDE<\/strong>: Firefox ve Chrome taray\u0131c\u0131lar\u0131 i\u00e7in bir eklenti olarak \u00e7al\u0131\u015f\u0131r ve kullan\u0131c\u0131lar\u0131n test senaryolar\u0131n\u0131 kaydetmesine, d\u00fczenlemesine ve \u00e7al\u0131\u015ft\u0131rmas\u0131na olanak tan\u0131r. Kullan\u0131c\u0131lar, herhangi bir programlama bilgisi olmadan testler olu\u015fturabilirler.<\/li>\n<li><strong>Selenium Grid<\/strong>: Ayn\u0131 anda birden fazla makinede ve taray\u0131c\u0131da test \u00e7al\u0131\u015ft\u0131rmaya olanak tan\u0131r. Bu, da\u011f\u0131t\u0131k test y\u00fcr\u00fctme i\u00e7in kullan\u0131\u015fl\u0131d\u0131r ve test s\u00fcresini azalt\u0131r.<\/li>\n<li><strong>Selenium RC (Remote Control)<\/strong>: Web uygulamalar\u0131n\u0131 programl\u0131 bir \u015fekilde test etmek i\u00e7in kullan\u0131lan eski bir bile\u015fendir. WebDriver&#8217;\u0131n geli\u015ftirilmesiyle birlikte RC&#8217;nin kullan\u0131m\u0131 azalm\u0131\u015ft\u0131r ve art\u0131k \u00f6nerilmemektedir.<\/li>\n<\/ol>\n<p>Selenium, otomatik test senaryolar\u0131 olu\u015fturma, s\u00fcrekli entegrasyon sistemlerine entegrasyon sa\u011flama ve taray\u0131c\u0131 tabanl\u0131 i\u015flemleri otomatikle\u015ftirme gibi ama\u00e7lar i\u00e7in yayg\u0131n olarak kullan\u0131l\u0131r. \u00d6zellikle yaz\u0131l\u0131m test m\u00fchendisleri ve geli\u015ftiriciler aras\u0131nda pop\u00fclerdir \u00e7\u00fcnk\u00fc web uygulamalar\u0131n\u0131n do\u011fru \u00e7al\u0131\u015ft\u0131\u011f\u0131ndan emin olmak i\u00e7in etkili bir \u00e7\u00f6z\u00fcm sunar.<\/p>\n<p>&nbsp;<\/p>\n<p>Bir yaz\u0131l\u0131m geli\u015ftiricisi olarak g\u00fcnl\u00fck i\u015fimde otomasyon s\u00fcre\u00e7lerini \u00f6zel Linux sunucular\u0131nda bar\u0131nd\u0131r\u0131yorum. <strong>Selenium Linux&#8217;ta \u00e7al\u0131\u015fabilir mi<\/strong>? \u0130lk sorum buydu. Hat\u0131rlayal\u0131m, bir Linux sunucusu grafiksel bir kullan\u0131c\u0131 aray\u00fcz\u00fc olmadan \u00e7al\u0131\u015f\u0131r. Dahas\u0131, otomasyon y\u00fcr\u00fctme bir taray\u0131c\u0131daki eylemlere benzer ve her seferinde a\u00e7\u0131lan bir pencereye ihtiya\u00e7 duyar. Peki, Selenium Linux sunucular\u0131nda nas\u0131l \u00e7al\u0131\u015f\u0131r?<\/p>\n<p>Linux Sunucusunda Selenium<br \/>\nLinux sunucuya Selenium y\u00fcklemek i\u00e7in Selenium, Chromedriver ve Chrome&#8217;un ikili versiyonunu y\u00fcklememiz gerekiyor.<\/p>\n<p><strong>1) Sistemi g\u00fcncelleyin<\/strong><br \/>\nHerhangi bir durumda Linux makinenize girdi\u011finizde paketleri g\u00fcncelleyin.<\/p>\n<blockquote><p>sudo apt-get update<br \/>\nsudo apt-get install -y unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4<\/p><\/blockquote>\n<p><strong>2) Chrome Binary&#8217;yi y\u00fckleyin<\/strong><br \/>\nKonu\u015ftu\u011fumuz gibi, eylemleri bir web taray\u0131c\u0131s\u0131nda taklit etmemiz gerekiyor, bunun i\u00e7in chrome ikili dosyas\u0131n\u0131 y\u00fcklememiz gerekiyor.<\/p>\n<p>Chrome&#8217;un en son kararl\u0131 s\u00fcr\u00fcm\u00fcn\u00fc y\u00fckleyece\u011fiz. Bunu hat\u0131rlamak \u00f6nemlidir, ancak yaln\u0131zca belirli Chrome s\u00fcr\u00fcc\u00fc s\u00fcr\u00fcm\u00fcyle \u00e7al\u0131\u015facakt\u0131r.<\/p>\n<blockquote><p># Install Chrome.<br \/>\nsudo curl -sS -o &#8211; https:\/\/dl-ssl.google.com\/linux\/linux_signing_key.pub | apt-key add<br \/>\nsudo echo &#8220;deb http:\/\/dl.google.com\/linux\/chrome\/deb\/ stable main&#8221; &gt;&gt; \/etc\/apt\/sources.list.d\/google-chrome.list<br \/>\n# Update our system<br \/>\nsudo apt-get -y update<br \/>\n# Install Chrome<br \/>\nsudo apt-get -y install google-chrome-stable<\/p><\/blockquote>\n<p><strong>3) Chromedriver&#8217;\u0131 y\u00fckleyin<\/strong><br \/>\nBu ad\u0131m \u00e7ok \u00f6nemlidir. Chrome s\u00fcr\u00fcc\u00fcs\u00fc, y\u00fckledi\u011finiz Chrome s\u00fcr\u00fcm\u00fcyle \u00f6zel olarak \u00e7al\u0131\u015f\u0131r .<\/p>\n<p>Beti\u011finiz \u00e7al\u0131\u015fm\u0131yorsa ve bir uyumsuzluk oldu\u011funu s\u00f6yl\u00fcyorsa, Chrome s\u00fcr\u00fcc\u00fcn\u00fczle e\u015fle\u015fen Chrome taray\u0131c\u0131n\u0131z\u0131n ikili dosyas\u0131n\u0131n do\u011fru s\u00fcr\u00fcm\u00fcn\u00fc y\u00fckledi\u011finizden emin olun .<\/p>\n<p>Ad\u0131m 2&#8217;de Chrome&#8217;un son s\u00fcr\u00fcm\u00fcn\u00fc y\u00fckledi\u011fimiz i\u00e7in s\u00fcr\u00fcm 95&#8217;tir. S\u00fcr\u00fcm 95 Chrome s\u00fcr\u00fcc\u00fcs\u00fcn\u00fc y\u00fcklememiz gerekiyor.<\/p>\n<blockquote><p># Install Chromedriver<br \/>\nwget -N https:\/\/chromedriver.storage.googleapis.com\/95.0.4638.54\/chromedriver_linux64.zip -P ~\/<br \/>\nunzip ~\/chromedriver_linux64.zip -d ~\/<br \/>\n# Remove zip file<br \/>\nrm ~\/chromedriver_linux64.zip<br \/>\n# Move driver to bin location<br \/>\nsudo mv -f ~\/chromedriver \/usr\/local\/bin\/chromedriver<br \/>\n# Give it rights<br \/>\nsudo chown root:root \/usr\/local\/bin\/chromedriver<br \/>\nsudo chmod 0755 \/usr\/local\/bin\/chromedriver<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>2. sat\u0131ra dikkat edin, etki alan\u0131ndan sonra s\u00fcr\u00fcm\u00fc indirilecek \u015fekilde ayarlad\u0131m (95.0.4638.54). Uyumsuzluk nedeniyle Headless durumunda \u00e7al\u0131\u015f\u0131rken sorun ya\u015farsan\u0131z, oraya bir g\u00f6z at\u0131n. Hangi Chrome s\u00fcr\u00fcm\u00fcn\u00fcn hangi Chrome s\u00fcr\u00fcc\u00fcs\u00fc s\u00fcr\u00fcm\u00fcyle \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 buradan kontrol edebilirsiniz:<\/p>\n<p>ChromeDriver &#8211; Chrome i\u00e7in WebDriver &#8211; \u0130ndirmeler<br \/>\nG\u00fcncel S\u00fcr\u00fcmler Chrome s\u00fcr\u00fcm 96 kullan\u0131yorsan\u0131z, l\u00fctfen ChromeDriver 96.0.4664.35&#8217;i indirin Chrome kullan\u0131yorsan\u0131z\u2026<br \/>\n<a href=\"https:\/\/sites.google.com\/chromium.org\/driver\/downloads?authuser=0&amp;source=post_page-----e8928b2b709--------------------------------\" rel=\"nofollow noopener\" target=\"_blank\">siteler.google.com<\/a><\/p>\n<p><strong>4) Selenium&#8217;u y\u00fckleyin<\/strong><\/p>\n<p>Haz\u0131r\u0131z! Kurulumumuzu test edelim.<\/p>\n<blockquote><p># Install Selenium<\/p>\n<p>pip install selenium<\/p><\/blockquote>\n<p><strong>5) Python Scripti ve Selenium<\/strong><br \/>\nPython beti\u011fimizi olu\u015ftural\u0131m ve www.python.org adresinden python ba\u015fl\u0131\u011f\u0131n\u0131 almaya \u00e7al\u0131\u015fal\u0131m.<\/p>\n<blockquote><p>from selenium import webdriver<br \/>\nfrom selenium.webdriver.chrome.options import Options<br \/>\nfrom selenium.webdriver.chrome.service import Service<\/p>\n<p># Set path Selenium<br \/>\nCHROMEDRIVER_PATH = &#8216;\/usr\/local\/bin\/chromedriver&#8217;<br \/>\ns = Service(CHROMEDRIVER_PATH)<br \/>\nWINDOW_SIZE = &#8220;1920,1080&#8221;<\/p>\n<p># Options<br \/>\nchrome_options = Options()<br \/>\nchrome_options.add_argument(&#8220;&#8211;headless&#8221;)<br \/>\nchrome_options.add_argument(&#8220;&#8211;window-size=%s&#8221; % WINDOW_SIZE)<br \/>\nchrome_options.add_argument(&#8216;&#8211;no-sandbox&#8217;)<br \/>\ndriver = webdriver.Chrome(service=s, options=chrome_options)<\/p>\n<p># Get the response and print title<br \/>\ndriver.get(&#8220;https:\/\/www.python.org&#8221;)<br \/>\nprint(driver.title)<br \/>\ndriver.close()<\/p><\/blockquote>\n<p>Beti\u011fimizi \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131zda www.python.org web sayfas\u0131n\u0131n ba\u015fl\u0131k eleman\u0131 g\u00f6r\u00fcnt\u00fclenecektir:<\/p>\n<p>Python.org&#8217;a ho\u015f geldiniz<\/p>\n<p>\u0130\u015fte bu kadar! Linux sunucularda Selenium&#8217;u uygulamaya haz\u0131rs\u0131n\u0131z.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux sunucularda bar\u0131nd\u0131r\u0131lan otomasyon testlerini \u00e7al\u0131\u015ft\u0131rmak geri d\u00f6n\u00fc\u015f\u00fc olmayacak \u015fekilde \u015fu soruyu akla getiriyor: Linux&#8217;a Selenium nas\u0131l kurulur? Selenium Nedir? Selenium, web uygulamalar\u0131n\u0131 otomatikle\u015ftirmek i\u00e7in kullan\u0131lan pop\u00fcler bir ara\u00e7t\u0131r. Bir dizi ara\u00e7 ve k\u00fct\u00fcphaneden olu\u015fur ve taray\u0131c\u0131 tabanl\u0131 uygulamalar\u0131 test etmek ve otomatikle\u015ftirmek i\u00e7in kullan\u0131l\u0131r. \u0130\u015fte Selenium hakk\u0131nda baz\u0131 temel bilgiler: Selenium WebDriver: Selenium&#8217;un \u00e7ekirdek &hellip;<\/p>\n","protected":false},"author":1,"featured_media":8230,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[84],"tags":[],"class_list":["post-8227","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-genel-tr"],"acf":[],"_links":{"self":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts\/8227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/comments?post=8227"}],"version-history":[{"count":0,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts\/8227\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/media\/8230"}],"wp:attachment":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/media?parent=8227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/categories?post=8227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/tags?post=8227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}