<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Selinium &#8211; Python Programs</title>
	<atom:link href="https://python-programs.com/category/python/selinium/feed/" rel="self" type="application/rss+xml" />
	<link>https://python-programs.com</link>
	<description>Python Programs with Examples, How To Guides on Python</description>
	<lastBuildDate>Fri, 10 Nov 2023 06:10:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.8</generator>
<site xmlns="com-wordpress:feed-additions:1">196068054</site>	<item>
		<title>Simple Whatsapp Automation Using Python3 and Selenium</title>
		<link>https://python-programs.com/simple-whatsapp-automation-using-python3-and-selenium/</link>
		
		<dc:creator><![CDATA[Bahija Siddiqui]]></dc:creator>
		<pubDate>Sun, 15 Oct 2023 11:36:17 +0000</pubDate>
				<category><![CDATA[Selinium]]></category>
		<guid isPermaLink="false">https://python-programs.com/?p=2291</guid>

					<description><![CDATA[In this article, we will be using python and selenium to automate some messages on WhatsApp. I hope the reader is well aware of python beforehand. The first and the foremost step is to install python3 which you can download from https://www.python.org/  and follow up the install instruction. After the installation will be complete, install [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span style="font-weight: 400">In this article, we will be using python and selenium to automate some messages on WhatsApp.</span></p>
<p><span style="font-weight: 400">I hope the reader is well aware of python beforehand.</span></p>
<p><span style="font-weight: 400">The first and the foremost step is to install python3 which you can download from </span><a href="https://www.python.org/"><span style="font-weight: 400">https://www.python.org/</span></a><span style="font-weight: 400">  and follow up the install instruction. After the installation will be complete, install selenium for the automation of all the tasks we want to perform.</span></p>
<pre><b><i>python3 -m pip install Selenium

</i></b></pre>
<h2><span style="font-weight: 400">Selenium Hello World:</span></h2>
<p><span style="font-weight: 400">After installing selenium, to check whether it is installed correctly or not, run the python code mentioned below and check if there are any errors.</span></p>
<pre><b><i>from selenium import webdriver</i></b>

<b><i>import time</i></b>

<b><i>driver = webdriver.Chrome()</i></b>

<b><i>driver.get("http://google.com")</i></b>

<b><i>time.sleep(2)</i></b>

<b><i>driver.quit()</i></b></pre>
<p><span style="font-weight: 400">Save this code in a python file and name it according to your preference. If the program runs correctly without showing any errors, then the Google Chrome window will be opened automatically.</span></p>
<h2><span style="font-weight: 400">Automate Whatsapp:</span></h2>
<p><span style="font-weight: 400">Import the modules selenium and time like below.</span></p>
<pre><b><i>from </i></b><b><i>selenium </i></b><b><i>import </i></b><b><i>webdriver</i></b>

<b><i>import </i></b><b><i>time</i></b></pre>
<p><b><span style="font-weight: 400">After the importing of the modules, the below code will open the WhatsApp web interface which will automatically ask you to scan the QR code and will be logged into your account.</span></b></p>
<pre><b><i>driver = webdriver.Chrome()</i></b>

<b><i>driver.get("https://web.whatsapp.com")</i></b>

<b><i>print("Scan QR Code, And then Enter")</i></b>

<b><i>time.sleep(5)</i></b></pre>
<p><span style="font-weight: 400">The next step is entering the username to whom you want to send the message. In my case, I made a group named “</span><i><span style="font-weight: 400">WhatsApp bot</span></i><span style="font-weight: 400">” and then located an XPath using the inspect method and put it in.</span></p>
<p><span style="font-weight: 400">As soon as the WhatsApp bot will be opened, it will automatically locate the </span><i><span style="font-weight: 400">WhatsApp bot </span></i><span style="font-weight: 400">and will enter that window.</span></p>
<pre><b><i>user_name = </i></b><b><i>'Whatsapp Bot'</i></b>

<b><i>user = driver.find_element_by_xpath(</i></b><b><i>'//span[@title="{}"]'</i></b><b><i>.format(user_name))</i></b>

<b><i>user.click()</i></b>

</pre>
<p><span style="font-weight: 400">After this, the message box will be opened and now you have to inspect the message box and enter the message you want to send. Later, you have to inspect the send button and click on it using the click() method. </span></p>
<pre><em><strong>message_box = driver.find_element_by_xpath('//div[@class="_2A8P4"]')</strong></em>

<em><strong>message_box.send_keys('Hey, I am your whatsapp bot')</strong></em>

<em><strong>message_box = driver.find_element_by_xpath('//button[@class="_1E0Oz"]')</strong></em>

<em><strong>message_box.click()</strong></em><b><i>

</i></b></pre>
<p><span style="font-weight: 400">As soon as you execute this code, the message will be sent and your work is done.</span></p>
<p><span style="font-weight: 400">I am attaching the whole code for your reference.</span></p>
<pre><b><i>from </i></b><b><i>selenium </i></b><b><i>import </i></b><b><i>webdriver</i></b>

<b><i>import </i></b><b><i>time</i></b>


<b><i>driver = webdriver.Chrome(</i></b><b><i>executable_path</i></b><b><i>=””)</i></b>

<b><i>time.sleep(</i></b><b><i>5</i></b><b><i>)</i></b>

<b><i>user_name = </i></b><b><i>'Whatsapp Bot'</i></b>

<b><i>user = driver.find_element_by_xpath(</i></b><b><i>'//span[@title="{}"]'</i></b><b><i>.format(user_name))</i></b>

<b><i>user.click()</i></b>



<b><i>message_box = driver.find_element_by_xpath(</i></b><b><i>'//div[@class="_2A8P4"]'</i></b><b><i>)</i></b>

<b><i>message_box.send_keys(</i></b><b><i>'Hey, I am your whatsapp bot'</i></b><b><i>)</i></b>

<b><i>message_box = driver.find_element_by_xpath(</i></b><b><i>'//button[@class="_1E0Oz"]'</i></b><b><i>)</i></b>

<b><i>message_box.click()</i></b>

<b><i>driver.quit()</i></b></pre>
<p><span style="font-weight: 400">At the end we put driver.quit() method to end the execution of the task.</span></p>
<p><b><i>You did a great job making this bot!!</i></b></p>
<p><b><i> </i></b></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2291</post-id>	</item>
		<item>
		<title>Python Selenium Tutorial &#124; Selenium Python Training for Beginners</title>
		<link>https://python-programs.com/python-selenium-tutorial/</link>
		
		<dc:creator><![CDATA[veer]]></dc:creator>
		<pubDate>Tue, 06 Jul 2021 11:07:26 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Selinium]]></category>
		<guid isPermaLink="false">https://python-programs.com/?p=7417</guid>

					<description><![CDATA[Python is the most famous programming language that helps developers to code any logic for an application or game or website easily and quickly. The most powerful tool to control web browsers via programs and perform browser automation is &#8216;Selenium&#8216;. This is helpful for all browsers and also operates on all major operating systems. The [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Python is the most famous programming language that helps developers to code any logic for an application or game or website easily and quickly. The most powerful tool to control web browsers via programs and perform browser automation is &#8216;<em>Selenium</em>&#8216;. This is helpful for all browsers and also operates on all major operating systems. The scripts of selenium are written in different languages ie., Python, Java, C#, etc.</p>
<p>Here, we will be working with Python. This <a href="https://python-programs.com/">BTech Geeks</a> <strong>Python Selenium Tutorial</strong> includes all topics related to it like Selenium WebDriver, why learn selenium with python, How to integrate Selenium with Python Unit Tests. Moreover, it covers selenium with python concepts from basics to advanced and professional uses.</p>
<ul>
<li><a href="#Python_Selenium_|_Selenium_with_Python_Tutorial_PDF_for_Beginners">Python Selenium | Selenium with Python Tutorial PDF for Beginners</a></li>
<li><a href="#What_is_Selenium?">What is Selenium?</a></li>
<li><a href="#Browsers_supported_by_Selenium">Browsers supported by Selenium</a></li>
<li><a href="#Why_learn_Selenium_Python?">Why learn Selenium Python?</a></li>
<li><a href="#Why_we_use_Selenium_for_automation_testing?">Why we use Selenium for automation testing?</a></li>
<li><a href="#How_to_integrate_Selenium_with_Python_Unit_Tests">How to integrate Selenium with Python Unit Tests</a></li>
<li><a href="#Why_to_choose_Python_over_Java_in_Selenium">Why to choose Python over Java in Selenium</a></li>
<li><a href="#Selenium_with_Python">Selenium with Python</a></li>
<li><a href="#Install_Selenium_Libraries_With_Python">Install Selenium Libraries With Python</a></li>
<li><a href="#List_of_Python_Selenium_Interview_Questions_and_Answers">List of Python Selenium Interview Questions and Answers</a></li>
</ul>
<h2><a id="Python_Selenium_|_Selenium_with_Python_Tutorial_PDF_for_Beginners"></a>Python Selenium | Selenium with Python Tutorial PDF for Beginners</h2>
<ul>
<li><a href="https://python-programs.com/selenium-python-tutorial/">Chapter 1 Introduction to Selenium</a></li>
<li><a href="https://python-programs.com/selenium-ide-tutorial/">Chapter 2 Selenium IDE</a></li>
<li><a href="https://python-programs.com/locators-in-selenium/">Chapter 3 Locators in Selenium</a></li>
<li><a href="https://python-programs.com/how-to-install-selenium-in-python/">Chapter 4 Installation and setup</a></li>
<li><a href="https://python-programs.com/selenium-webdriver-tutorial-with-examples/">Chapter 5 Understanding WebDriver, WebElement and By</a></li>
<li><a href="https://python-programs.com/selenium-python-test-suite-unittest/">Chapter 6 Unittest in Python</a></li>
<li><a href="https://python-programs.com/synchronization-in-selenium-python/">Chapter 7 Synchronizing Test</a></li>
<li><a href="https://python-programs.com/parameterization-in-pytest-with-selenium/">Chapter 8 Concept of Parameterization</a></li>
<li><a href="https://python-programs.com/how-to-locate-different-web-elements-in-selenium-using-python/">Chapter 9 Working with Different Web Elements</a></li>
<li><a href="https://python-programs.com/selenium-python-frames-alerts-and-action-class/">Chapter 10 Frames, Alerts, and Action Class</a></li>
<li><a href="https://python-programs.com/page-object-model-in-selenium-python/">Chapter 11 Page Object Model</a></li>
<li><a href="https://python-programs.com/selenium-grid/">Chapter 12 Selenium-Grid</a></li>
</ul>
<p><strong>Related Articles:</strong></p>
<ul>
<li><a href="https://python-programs.com/python-programming/">Python Programming Language</a></li>
<li><a href="https://python-programs.com/python-programming-examples-with-output/">Python Programming Examples with Output</a></li>
<li><a href="https://python-programs.com/python-data-analysis-using-pandas/">Python Data Analysis Using Pandas</a></li>
<li><a href="https://python-programs.com/python-mysql-tutorial/">Python Mysql Tutorial</a></li>
<li><a href="https://python-programs.com/numpy-array-tutorial/">Python Numpy Array Tutorial</a></li>
<li><a href="https://python-programs.com/python-data-persistence/">Python Data Persistence</a></li>
<li><a href="https://python-programs.com/python-interview-questions/">Python Interview Questions</a></li>
<li><a href="https://python-programs.com/python-handwritten-notes/">Python Handwritten Notes</a></li>
<li><a href="https://python-programs.com/python-lecture-notes/">Python Lecture Notes</a></li>
</ul>
<h3><a id="What_is_Selenium?"></a>What is Selenium?</h3>
<p>Selenium is the most widely utilized open-source Web UI (User Interface) automation testing suite, that can be downloaded from the internet without spending anything. It can be efficiently deployed on platforms like Windows, Linux, Solaris, and Macintosh.</p>
<p>Selenium is a functional testing tool and also fits with non-functional testing tools as well. Currently, the Selenium Web driver is most familiar with Java and C#. The test scripts of Selenium can be coded in any of the supported programming languages and can be run straight away in most modern web browsers.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-11664 aligncenter" src="https://python-programs.com/wp-content/uploads/2021/05/what-is-selenium.png" alt="what is selenium" width="605" height="313" srcset="https://python-programs.com/wp-content/uploads/2021/05/what-is-selenium.png 605w, https://python-programs.com/wp-content/uploads/2021/05/what-is-selenium-300x155.png 300w" sizes="(max-width: 605px) 100vw, 605px" /></p>
<h3><a id="Browsers_supported_by_Selenium"></a>Browsers supported by Selenium</h3>
<p>The list of most commonly supported browsers by the selenium are included:</p>
<ul>
<li>Internet Explorer,</li>
<li>Mozilla Firefox,</li>
<li>Google Chrome, and</li>
<li>Safari.</li>
</ul>
<h3><a id="Why_learn_Selenium_Python?"></a>Why learn Selenium Python?</h3>
<ul>
<li><strong>Easier to understand and implement:</strong> The commands of selenium are classified in terms of various classes that make them easy to understand and implement.</li>
<li><strong>Open Source and Portable:</strong> It is an open-source and portable web testing framework.</li>
<li><strong>Cost reduction for Business Clients:</strong> By using the automation testing tool, the business can save paying the testers their salary. It saves time, cost benefits to the business.</li>
<li><strong>Less burden and stress for testers:</strong> As we said earlier, the amount of time needed to do testing on every new build is lessen to zero, almost. Thus, the burden of the tester gets reduced.</li>
<li><strong>Combination of tool and DSL:</strong> It is a blend of tools and Domain Specific Language (DSL) to perform different types of tests.</li>
</ul>
<h3><a id="Why_we_use_Selenium_for_automation_testing?"></a>Why we use Selenium for automation testing?</h3>
<p>The most famous automation testing tool is Selenium. Automation testing means the process of converting any manual test case into test scripts using automation tools like Selenium. If you want to know why we use Selenium for automation testing then make sure to have a look at the following aspects:</p>
<ul>
<li>We can write a Selenium test script in any programming language such as Java, Python, C#, Ruby, Perl, as so on.</li>
<li>The test scripts can be performed in various OS platforms like Windows, Mac, Linux, etc.</li>
<li>Also, these scripts can be implemented on various browsers like Google Chrome, Mozilla Firefox, Internet Explorer, Safari, etc.</li>
<li>The testing tool of selenium can also be associated with various testing tools like TestNG, Junit for managing the test cases, and generating test reports.</li>
<li>To do endless testing, Selenium is combined with Maven, Jenkins, and Docker testing tools.</li>
</ul>
<h3><a id="How_to_integrate_Selenium_with_Python_Unit_Tests"></a>How to integrate Selenium with Python Unit Tests</h3>
<p>In this section, we are going to discuss how to integrate Selenium tests with python unit tests and try to understand the concept easily. Thus, we will be using the unit test module in python.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python">import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class ChromeSearch(unittest.TestCase):

def setUp(self):
self.driver = webdriver.Chrome('./chromedriver')

def test_search_in_python_org(self):
driver = self.driver
driver.get("https://www.python.org")
self.assertIn("Python", driver.title)
elem = driver.find_element_by_name("q")
elem.send_keys("getting started with python")
elem.send_keys(Keys.RETURN)
assert "https://www.python.org/search/?q=getting+started+with+python&amp;submit=" == driver.current_url

def tearDown(self):
self.driver.close()

if __name__ == "__main__":
unittest.main()</pre>
<p>In this case, you require to set up the driver object when initializing the unit test class via the .Chrome() method. In the single test that we prove, the same text is put on the search bar and the resultant change in URL is compared to the URL that was seen first. You may additionally address a separate test for another browser and reuse the same functionality.</p>
<h3><a id="Why_to_choose_Python_over_Java_in_Selenium"></a>Why to choose Python over Java in Selenium</h3>
<p>The important points that support python over java to work with selenium is as follows:</p>
<ul>
<li>Java programs tend to run slower compared to Python programs.</li>
<li>Java uses static typing, while Python uses dynamic typing.</li>
<li>Python is easier and also extra compact compared to Java.</li>
<li>Java employs traditional braces to start and ends blocks, while Python uses indentation.</li>
</ul>
<h2><a id="Selenium_with_Python"></a>Selenium with Python</h2>
<p>By using python, you can run a Selenium test script in two ways. They are as such:</p>
<ol>
<li>Configure Selenium using Python</li>
<li>Configure PyDev in Eclipse.</li>
</ol>
<p>Now, we will observe how we configure Selenium with the help of the Python programing language:</p>
<h3>1. Configure Selenium using Python</h3>
<p>By following the below steps, we can configure Selenium using Python efficiently:</p>
<ul>
<li>Download and install Python on Windows</li>
<li>Install Selenium libraries in Python</li>
<li>Download and install PyCharm</li>
<li>Create a new project and write the Selenium test script</li>
<li>Run and validate the test scripts.</li>
</ul>
<h3>2. Configure PyDev in Eclipse</h3>
<p>One more way to perform the Selenium test script using Python is by Configure PyDev in Eclipse. To make it possible, we have to follow these two steps mentioned below:</p>
<ul>
<li>Install PyDev</li>
<li>Execute the Selenium test scripts using Python.</li>
</ul>
<h3><a id="Install_Selenium_Libraries_With_Python"></a>Install Selenium Libraries With Python</h3>
<p>At the time of python installation, Selenium libraries are not installed by default. In order to perform if the libraries are already present in your python, you have to open a command prompt and navigate to the path where you have installed a python and type “pip list“. By using this command, it will list all the libraries currently available in your Python.</p>
<p><img decoding="async" class="alignnone size-full wp-image-11662 aligncenter" src="https://python-programs.com/wp-content/uploads/2021/05/intall-selenium-libraries-with-python-using-pip.png" alt="intall selenium libraries with python using pip" width="725" height="271" srcset="https://python-programs.com/wp-content/uploads/2021/05/intall-selenium-libraries-with-python-using-pip.png 725w, https://python-programs.com/wp-content/uploads/2021/05/intall-selenium-libraries-with-python-using-pip-300x112.png 300w" sizes="(max-width: 725px) 100vw, 725px" /></p>
<h3><a id="List_of_Python_Selenium_Interview_Questions_and_Answers"></a>List of Python Selenium Interview Questions and Answers</h3>
<p>The most commonly asked Interview Question and Answer in Selenium with Python suites for both Freshers and Experienced Candidates are listed here by BTech Geeks :</p>
<ol>
<li>What Is Python?</li>
<li>What is Selenium?</li>
<li>How Python Can Be Used In Software Testing?</li>
<li>What Python Frameworks Do You Know?</li>
<li> What is the commands for downloading selenium?</li>
<li>What Tools That Helps Python Development Do You Know?</li>
<li>What Is The Difference Between “xrange” And “range”?</li>
<li>What Is A “unit test” In Python?</li>
<li>How can we implement unittest framework in our scripts?</li>
<li>Define “module” And “package”?</li>
</ol>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7417</post-id>	</item>
		<item>
		<title>Automation of Whatsapp Messages to unknown Users using selenium and Python</title>
		<link>https://python-programs.com/automation-of-whatsapp-messages-to-unknown-users-using-selenium-and-python/</link>
		
		<dc:creator><![CDATA[Bahija Siddiqui]]></dc:creator>
		<pubDate>Thu, 22 Apr 2021 02:24:12 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Selinium]]></category>
		<guid isPermaLink="false">https://python-programs.com/?p=2241</guid>

					<description><![CDATA[Nowadays, we have to send messages to multiple users for either personal reasons or for commercial as well as business reasons.  How amazing it will be if we don&#8217;t have to send messages again and again typing the same thing to more than 100 contacts. It will be hectic and boring.In this article, we will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Nowadays, we have to send messages to multiple users for either personal reasons or for commercial as well as business reasons. </p>
<p>How amazing it will be if we don&#8217;t have to send messages again and again typing the same thing to more than 100 contacts. It will be hectic and boring.<br />In this article, we will be making a WhatsApp bot that will automate the messages and send the messages to multiple users at the same time without you typing it again and again.</p>
<p>This Bot will make your work easy and will be less time-consuming.</p>
<p><em><strong>Let&#8217;s get ready to mak</strong></em><em><strong>e an automation bot!</strong></em></p>
<h2>Importing the modules:</h2>
<p>To make this automation Bot, we have to import some modules.</p>
<p>Firstly, we have to import selenium and python as a basic step.</p>
<p>To import selenium type the following command in your terminal:</p>
<pre>python -m pip install selenium</pre>
<p>Now we have to install WebDriver.</p>
<p>For doing so, go on <a href="https://github.com/mozilla/geckodriver/releases" rel="nofollow noreferrer">geckodriver releases page</a> and find the latest version suitable for your desktop.</p>
<p>Extract the file and copy the path and write it in your code.</p>
<p><em><strong>Let&#8217;s get started with the code!</strong></em></p>
<h3>Working on the code:</h3>
<p>The first and foremost task is to import the selenium modules which will be used in the code.</p>
<p>from selenium import webdriver<br />from csv import reader<br />import time</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2241</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 

Served from: python-programs.com @ 2026-11-17 05:50:42 by W3 Total Cache
-->