{"id":23233,"date":"2022-11-24T18:36:45","date_gmt":"2022-11-24T13:06:45","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/"},"modified":"2022-11-24T18:36:45","modified_gmt":"2022-11-24T13:06:45","slug":"solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/","title":{"rendered":"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-56216574\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"56216574\" data-parentid=\"56216171\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Try this:<\/p>\n<pre><code>from selenium import webdriver\nimport time\nfrom selenium.webdriver.common.keys import Keys\nfrom bs4 import BeautifulSoup\nfrom bs4.element import Tag\n\ndriver = webdriver.Chrome(\"C:\/Users\/RoshanB\/Desktop\/sentiment1\/chromedriver_win32\/chromedriver\")\ndriver.get('http:\/\/www.careratings.com\/brief-rationale.aspx')\ntime.sleep(4)\n\ncompanyArray = []\n\ntry:\n    search = driver.find_element_by_name('txtSearchCompany_brief')\n    search.send_keys(\"Reliance Capital Limited\")\n    search.send_keys(Keys.RETURN)\n    time.sleep(4)\n    soup = BeautifulSoup(driver.page_source, 'lxml')\n    companies = soup.find(\"table\",class_=\"table1\")\n\n    for tag in companies.findChildren():\n        if isinstance(tag, Tag) and tag.name in 'a' and tag.has_attr('href'):\n            url_string = \"http:\/\/www.careratings.com\/\"+tag['href'].replace (\" \",\"%20\")\n\"\"\" **Open pdf file in new tab browser** \"\"\"\n            open_pdf(url_string)\n            companyArray.append(tag.text)\n\nexcept Exception as e:\n    print(e)\n\ndriver.quit()\nprint(companyArray)\n<\/code><\/pre>\n<p>O\/P<\/p>\n<p>Company list:<\/p>\n<pre><code>['Reliance Capital Limited', 'Dewan Housing Finance Corporation Limited Ratings of various Securitisation transactions', 'Gamut Infosystems Limited', 'Henraajh Feeds India Private Limited', 'Ramdhan Spintex', 'Tripurashwari Agro Product Private Limited', 'Kalyaneswari Polyfabs Private Limited', 'Rakesh Kumar Gupta Rice Mills Private Limited', 'Sri Satnam Jewells Private Limited', 'Pitambara Foods', 'Sujata Udit Builders Private Limited', 'Kavita Industries', 'Krishna Industries', 'Pallavi Motors Private Limited', 'Anjani Cotgin', 'Sarala Foods Private Limited', 'B.M. Enterprises', 'Bihani Agro Foods Private Limited', 'M V Agrotech Private Limited', 'J.S.R &amp; Company', 'ARG Royal Ensign Developers Private Limited', 'Ranergy Solutions Private Limited', 'RSI Switchgear Private Limited', 'Jyoti Chandrashekhar Bawankule', 'Sadguru Engineers &amp; Allied Services Private Limited', 'R B Rungta Steels &amp; Food Products Private Limited', 'V. N. Marketing', 'Aussee Oats India Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Dewan Housing Finance Corporation Limited', 'Pacific Medical University', 'S. K. Pradhan Construction Company Private Limited', 'Stadmed Private Limited', 'Namra Finance Limited', 'S Kumars Associates', 'R. R. and Company Private Limited']\n<\/code><\/pre>\n<p>if you want to <strong>scrape<\/strong> company name, need to install <strong>BeautifulSoup<\/strong> package<\/p>\n<pre><code>pip install beautifulsoup4==4.7.1\n<\/code><\/pre>\n<p>Where:<\/p>\n<p><strong>txtSearchCompany_brief<\/strong> is input search name<\/p>\n<p><strong>table1<\/strong> is search results table class<\/p>\n<p><strong>Download pdf file link:<\/strong><\/p>\n<p>Chromedriver, Selenium &#8211; Automate downloads<\/p>\n<p><strong>Read pdf file link:<\/strong><\/p>\n<p>How to read line by line in pdf file using PyPdf?<\/p>\n<p><strong>Open pdf file in a new tab:<\/strong><\/p>\n<pre><code>def open_pdf(url_string):\n    driver1 = webdriver.Chrome(\"C:\/Users\/RoshanB\/Desktop\/sentiment1\/chromedriver_win32\/chromedriver\")\n    driver1.get(url_string)\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">7<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How to click on the Search company name button,type company name and search using Selenium and Python? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Try this: from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup from bs4.element import Tag driver = webdriver.Chrome(&#8220;C:\/Users\/RoshanB\/Desktop\/sentiment1\/chromedriver_win32\/chromedriver&#8221;) driver.get(&#8216;http:\/\/www.careratings.com\/brief-rationale.aspx&#8217;) time.sleep(4) companyArray = [] try: search = driver.find_element_by_name(&#8216;txtSearchCompany_brief&#8217;) search.send_keys(&#8220;Reliance Capital Limited&#8221;) search.send_keys(Keys.RETURN) time.sleep(4) soup = BeautifulSoup(driver.page_source, &#8216;lxml&#8217;) companies = soup.find(&#8220;table&#8221;,class_=&#8221;table1&#8243;) for tag in companies.findChildren(): if isinstance(tag, Tag) and tag.name in &#8230; <a title=\"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\" aria-label=\"More on [Solved] How to click on the Search company name button,type company name and search using Selenium and Python?\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[349,720,611,1138,760],"class_list":["post-23233","post","type-post","status-publish","format-standard","hentry","category-solved","tag-python","tag-search","tag-selenium","tag-selenium-webdriver","tag-web-scraping"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How to click on the Search company name button,type company name and search using Selenium and Python? - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python? - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Try this: from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup from bs4.element import Tag driver = webdriver.Chrome(&quot;C:\/Users\/RoshanB\/Desktop\/sentiment1\/chromedriver_win32\/chromedriver&quot;) driver.get(&#039;http:\/\/www.careratings.com\/brief-rationale.aspx&#039;) time.sleep(4) companyArray = [] try: search = driver.find_element_by_name(&#039;txtSearchCompany_brief&#039;) search.send_keys(&quot;Reliance Capital Limited&quot;) search.send_keys(Keys.RETURN) time.sleep(4) soup = BeautifulSoup(driver.page_source, &#039;lxml&#039;) companies = soup.find(&quot;table&quot;,class_=&quot;table1&quot;) for tag in companies.findChildren(): if isinstance(tag, Tag) and tag.name in ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-24T13:06:45+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?\",\"datePublished\":\"2022-11-24T13:06:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\"},\"wordCount\":102,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"python\",\"search\",\"selenium\",\"selenium-webdriver\",\"web-scraping\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\",\"name\":\"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python? - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-11-24T13:06:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python? - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python? - JassWeb","og_description":"[ad_1] Try this: from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup from bs4.element import Tag driver = webdriver.Chrome(\"C:\/Users\/RoshanB\/Desktop\/sentiment1\/chromedriver_win32\/chromedriver\") driver.get('http:\/\/www.careratings.com\/brief-rationale.aspx') time.sleep(4) companyArray = [] try: search = driver.find_element_by_name('txtSearchCompany_brief') search.send_keys(\"Reliance Capital Limited\") search.send_keys(Keys.RETURN) time.sleep(4) soup = BeautifulSoup(driver.page_source, 'lxml') companies = soup.find(\"table\",class_=\"table1\") for tag in companies.findChildren(): if isinstance(tag, Tag) and tag.name in ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/","og_site_name":"JassWeb","article_published_time":"2022-11-24T13:06:45+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?","datePublished":"2022-11-24T13:06:45+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/"},"wordCount":102,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["python","search","selenium","selenium-webdriver","web-scraping"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/","url":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/","name":"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python? - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-11-24T13:06:45+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-click-on-the-search-company-name-buttontype-company-name-and-search-using-selenium-and-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/23233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=23233"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/23233\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=23233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=23233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=23233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}