How to get data from dynamic web elements[id] and write that data in excel dynamically in the adjacent cell...
Actually, I am automating a web chatbot. I am facing a problem to get the data from dynamic elements which have the same class name for all the web elements related to chat text. see below for the HTML code.
<div class="box-body" style="flex: 1;overflow: hidden"><!-- Conversations are loaded here--><div class="direct-chat-messages"><!-- Message. Default to the left--><div class="chat-individuals clearfix" id="35e2e858-dece-eb9e-70b2-ced0d28849e3"><div class="direct-chat-msg right"><div class="direct-chat-text">hi</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="09ccac6a-00a0-493f-a489-621af631c5df"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Hello Kamala@96! I am Maya, your personal assistant. How may I help you?</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Book a cab')">Book a cab</div><div class="options-div" onclick="triggerAnswerNikki('Book a movie')">Book a movie</div><div class="options-div" onclick="triggerAnswerNikki('Recharge')">Recharge</div><div class="options-div" onclick="triggerAnswerNikki('Book Bus')">Book Bus</div><div class="options-div" onclick="triggerAnswerNikki('Play games')">Play games</div><div class="options-div" onclick="triggerAnswerNikki('News')">News</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="8808fb8f-5358-b71f-2240-a1480daa12ef"><div class="direct-chat-msg right"><div class="direct-chat-text">book a cab</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="5678e7f3-0c76-40b6-ad56-c2e8113f6657"><div class="direct-chat-msg left"><div class="direct-chat-text"><span></span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2141f74e-9250-4ea5-8876-ea0760839ae2"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Welcome ! Let me get you a cab. You can type <b>cancel</b> at any point to exit this conversation</span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="0e18992e-a084-4bcd-9407-0ce1c1cddede"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Your pickup location is: C1.04.08, Tower A, 4th Floor, Rattha Tek Meadows, Elcot Sez, Sholinganallur, Chennai </span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Change Source')">Change Source</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="b374870c-f988-4365-a279-1f83c115e21f"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>You can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Ola')">Ola</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="ad18d10f-21d9-40de-83c4-686cbcd16ada"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="f0f350c4-46d7-fc8f-e48b-943f23a8ec76"><div class="direct-chat-msg right"><div class="direct-chat-text">ola</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="659efca6-e2d5-4e4a-a7aa-9f6e056deb7c"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="eac2c45a-33ea-45be-824b-9dfa2b79c29d"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Or you can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Uber')">Uber</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2b5b902b-4e1c-0e3c-c94d-5fd7bf0f7c6e"><div class="direct-chat-msg right"><div class="direct-chat-text">Uber</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="51ee1640-95bf-4d20-987e-5800061e798d"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="440f92b7-0680-c379-1345-96b6ada25ba4"><div class="direct-chat-msg right"><div class="direct-chat-text">cancel</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:37 pm</span></div></div><div class="chat-individuals clearfix" id="9be75061-3c4b-4627-b37c-a7447719bf64"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>We'll meet again! </span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:37 pm</span></div></div></div></div>
both these classes are the same for all the text in the conversation. and the id is also kept on changing since it is a dynamic web element.
please help me handling the response of chatbot by writing it to the excel in the same cell of excel.
html selenium selenium-webdriver xpath apache-poi
|
show 2 more comments
Actually, I am automating a web chatbot. I am facing a problem to get the data from dynamic elements which have the same class name for all the web elements related to chat text. see below for the HTML code.
<div class="box-body" style="flex: 1;overflow: hidden"><!-- Conversations are loaded here--><div class="direct-chat-messages"><!-- Message. Default to the left--><div class="chat-individuals clearfix" id="35e2e858-dece-eb9e-70b2-ced0d28849e3"><div class="direct-chat-msg right"><div class="direct-chat-text">hi</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="09ccac6a-00a0-493f-a489-621af631c5df"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Hello Kamala@96! I am Maya, your personal assistant. How may I help you?</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Book a cab')">Book a cab</div><div class="options-div" onclick="triggerAnswerNikki('Book a movie')">Book a movie</div><div class="options-div" onclick="triggerAnswerNikki('Recharge')">Recharge</div><div class="options-div" onclick="triggerAnswerNikki('Book Bus')">Book Bus</div><div class="options-div" onclick="triggerAnswerNikki('Play games')">Play games</div><div class="options-div" onclick="triggerAnswerNikki('News')">News</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="8808fb8f-5358-b71f-2240-a1480daa12ef"><div class="direct-chat-msg right"><div class="direct-chat-text">book a cab</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="5678e7f3-0c76-40b6-ad56-c2e8113f6657"><div class="direct-chat-msg left"><div class="direct-chat-text"><span></span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2141f74e-9250-4ea5-8876-ea0760839ae2"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Welcome ! Let me get you a cab. You can type <b>cancel</b> at any point to exit this conversation</span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="0e18992e-a084-4bcd-9407-0ce1c1cddede"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Your pickup location is: C1.04.08, Tower A, 4th Floor, Rattha Tek Meadows, Elcot Sez, Sholinganallur, Chennai </span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Change Source')">Change Source</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="b374870c-f988-4365-a279-1f83c115e21f"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>You can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Ola')">Ola</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="ad18d10f-21d9-40de-83c4-686cbcd16ada"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="f0f350c4-46d7-fc8f-e48b-943f23a8ec76"><div class="direct-chat-msg right"><div class="direct-chat-text">ola</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="659efca6-e2d5-4e4a-a7aa-9f6e056deb7c"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="eac2c45a-33ea-45be-824b-9dfa2b79c29d"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Or you can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Uber')">Uber</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2b5b902b-4e1c-0e3c-c94d-5fd7bf0f7c6e"><div class="direct-chat-msg right"><div class="direct-chat-text">Uber</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="51ee1640-95bf-4d20-987e-5800061e798d"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="440f92b7-0680-c379-1345-96b6ada25ba4"><div class="direct-chat-msg right"><div class="direct-chat-text">cancel</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:37 pm</span></div></div><div class="chat-individuals clearfix" id="9be75061-3c4b-4627-b37c-a7447719bf64"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>We'll meet again! </span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:37 pm</span></div></div></div></div>
both these classes are the same for all the text in the conversation. and the id is also kept on changing since it is a dynamic web element.
please help me handling the response of chatbot by writing it to the excel in the same cell of excel.
html selenium selenium-webdriver xpath apache-poi
Can you share the URL of that chat client? In general, what I'm thinking is locate the class 'chat-individuals', go up one div and start a listener that watches if more 'chat-individuals' have appeared and takes the innerHTML from each new class. But the URL would be most helpful here.
– Alichino
Nov 15 '18 at 12:15
@Alichino even if I share URL is not enough for you. you have to get authorization by login id and password which is confidential. I can share you the entire HTML source code of a conversation between a user and chatbot. or please provide me your email id, I can try to send new temporary login id and pwd for you.
– Ranjith Kasu
Nov 15 '18 at 13:01
Let's try with the HTML, I'll see if I can do something with it.
– Alichino
Nov 15 '18 at 13:03
yeah, I have edited the body with updated HTML code, please have a look and let me know how to solve this problem
– Ranjith Kasu
Nov 15 '18 at 13:14
Hmm it's not easy... I'll try to think of something, after work maybe :)
– Alichino
Nov 15 '18 at 13:40
|
show 2 more comments
Actually, I am automating a web chatbot. I am facing a problem to get the data from dynamic elements which have the same class name for all the web elements related to chat text. see below for the HTML code.
<div class="box-body" style="flex: 1;overflow: hidden"><!-- Conversations are loaded here--><div class="direct-chat-messages"><!-- Message. Default to the left--><div class="chat-individuals clearfix" id="35e2e858-dece-eb9e-70b2-ced0d28849e3"><div class="direct-chat-msg right"><div class="direct-chat-text">hi</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="09ccac6a-00a0-493f-a489-621af631c5df"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Hello Kamala@96! I am Maya, your personal assistant. How may I help you?</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Book a cab')">Book a cab</div><div class="options-div" onclick="triggerAnswerNikki('Book a movie')">Book a movie</div><div class="options-div" onclick="triggerAnswerNikki('Recharge')">Recharge</div><div class="options-div" onclick="triggerAnswerNikki('Book Bus')">Book Bus</div><div class="options-div" onclick="triggerAnswerNikki('Play games')">Play games</div><div class="options-div" onclick="triggerAnswerNikki('News')">News</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="8808fb8f-5358-b71f-2240-a1480daa12ef"><div class="direct-chat-msg right"><div class="direct-chat-text">book a cab</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="5678e7f3-0c76-40b6-ad56-c2e8113f6657"><div class="direct-chat-msg left"><div class="direct-chat-text"><span></span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2141f74e-9250-4ea5-8876-ea0760839ae2"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Welcome ! Let me get you a cab. You can type <b>cancel</b> at any point to exit this conversation</span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="0e18992e-a084-4bcd-9407-0ce1c1cddede"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Your pickup location is: C1.04.08, Tower A, 4th Floor, Rattha Tek Meadows, Elcot Sez, Sholinganallur, Chennai </span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Change Source')">Change Source</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="b374870c-f988-4365-a279-1f83c115e21f"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>You can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Ola')">Ola</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="ad18d10f-21d9-40de-83c4-686cbcd16ada"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="f0f350c4-46d7-fc8f-e48b-943f23a8ec76"><div class="direct-chat-msg right"><div class="direct-chat-text">ola</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="659efca6-e2d5-4e4a-a7aa-9f6e056deb7c"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="eac2c45a-33ea-45be-824b-9dfa2b79c29d"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Or you can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Uber')">Uber</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2b5b902b-4e1c-0e3c-c94d-5fd7bf0f7c6e"><div class="direct-chat-msg right"><div class="direct-chat-text">Uber</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="51ee1640-95bf-4d20-987e-5800061e798d"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="440f92b7-0680-c379-1345-96b6ada25ba4"><div class="direct-chat-msg right"><div class="direct-chat-text">cancel</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:37 pm</span></div></div><div class="chat-individuals clearfix" id="9be75061-3c4b-4627-b37c-a7447719bf64"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>We'll meet again! </span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:37 pm</span></div></div></div></div>
both these classes are the same for all the text in the conversation. and the id is also kept on changing since it is a dynamic web element.
please help me handling the response of chatbot by writing it to the excel in the same cell of excel.
html selenium selenium-webdriver xpath apache-poi
Actually, I am automating a web chatbot. I am facing a problem to get the data from dynamic elements which have the same class name for all the web elements related to chat text. see below for the HTML code.
<div class="box-body" style="flex: 1;overflow: hidden"><!-- Conversations are loaded here--><div class="direct-chat-messages"><!-- Message. Default to the left--><div class="chat-individuals clearfix" id="35e2e858-dece-eb9e-70b2-ced0d28849e3"><div class="direct-chat-msg right"><div class="direct-chat-text">hi</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="09ccac6a-00a0-493f-a489-621af631c5df"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Hello Kamala@96! I am Maya, your personal assistant. How may I help you?</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Book a cab')">Book a cab</div><div class="options-div" onclick="triggerAnswerNikki('Book a movie')">Book a movie</div><div class="options-div" onclick="triggerAnswerNikki('Recharge')">Recharge</div><div class="options-div" onclick="triggerAnswerNikki('Book Bus')">Book Bus</div><div class="options-div" onclick="triggerAnswerNikki('Play games')">Play games</div><div class="options-div" onclick="triggerAnswerNikki('News')">News</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="8808fb8f-5358-b71f-2240-a1480daa12ef"><div class="direct-chat-msg right"><div class="direct-chat-text">book a cab</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="5678e7f3-0c76-40b6-ad56-c2e8113f6657"><div class="direct-chat-msg left"><div class="direct-chat-text"><span></span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2141f74e-9250-4ea5-8876-ea0760839ae2"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Welcome ! Let me get you a cab. You can type <b>cancel</b> at any point to exit this conversation</span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="0e18992e-a084-4bcd-9407-0ce1c1cddede"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Your pickup location is: C1.04.08, Tower A, 4th Floor, Rattha Tek Meadows, Elcot Sez, Sholinganallur, Chennai </span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Change Source')">Change Source</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="b374870c-f988-4365-a279-1f83c115e21f"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>You can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Ola')">Ola</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="ad18d10f-21d9-40de-83c4-686cbcd16ada"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="f0f350c4-46d7-fc8f-e48b-943f23a8ec76"><div class="direct-chat-msg right"><div class="direct-chat-text">ola</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="659efca6-e2d5-4e4a-a7aa-9f6e056deb7c"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="eac2c45a-33ea-45be-824b-9dfa2b79c29d"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Or you can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Uber')">Uber</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2b5b902b-4e1c-0e3c-c94d-5fd7bf0f7c6e"><div class="direct-chat-msg right"><div class="direct-chat-text">Uber</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="51ee1640-95bf-4d20-987e-5800061e798d"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="440f92b7-0680-c379-1345-96b6ada25ba4"><div class="direct-chat-msg right"><div class="direct-chat-text">cancel</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:37 pm</span></div></div><div class="chat-individuals clearfix" id="9be75061-3c4b-4627-b37c-a7447719bf64"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>We'll meet again! </span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:37 pm</span></div></div></div></div>
both these classes are the same for all the text in the conversation. and the id is also kept on changing since it is a dynamic web element.
please help me handling the response of chatbot by writing it to the excel in the same cell of excel.
<div class="box-body" style="flex: 1;overflow: hidden"><!-- Conversations are loaded here--><div class="direct-chat-messages"><!-- Message. Default to the left--><div class="chat-individuals clearfix" id="35e2e858-dece-eb9e-70b2-ced0d28849e3"><div class="direct-chat-msg right"><div class="direct-chat-text">hi</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="09ccac6a-00a0-493f-a489-621af631c5df"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Hello Kamala@96! I am Maya, your personal assistant. How may I help you?</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Book a cab')">Book a cab</div><div class="options-div" onclick="triggerAnswerNikki('Book a movie')">Book a movie</div><div class="options-div" onclick="triggerAnswerNikki('Recharge')">Recharge</div><div class="options-div" onclick="triggerAnswerNikki('Book Bus')">Book Bus</div><div class="options-div" onclick="triggerAnswerNikki('Play games')">Play games</div><div class="options-div" onclick="triggerAnswerNikki('News')">News</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="8808fb8f-5358-b71f-2240-a1480daa12ef"><div class="direct-chat-msg right"><div class="direct-chat-text">book a cab</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="5678e7f3-0c76-40b6-ad56-c2e8113f6657"><div class="direct-chat-msg left"><div class="direct-chat-text"><span></span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2141f74e-9250-4ea5-8876-ea0760839ae2"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Welcome ! Let me get you a cab. You can type <b>cancel</b> at any point to exit this conversation</span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="0e18992e-a084-4bcd-9407-0ce1c1cddede"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Your pickup location is: C1.04.08, Tower A, 4th Floor, Rattha Tek Meadows, Elcot Sez, Sholinganallur, Chennai </span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Change Source')">Change Source</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="b374870c-f988-4365-a279-1f83c115e21f"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>You can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Ola')">Ola</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="ad18d10f-21d9-40de-83c4-686cbcd16ada"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="f0f350c4-46d7-fc8f-e48b-943f23a8ec76"><div class="direct-chat-msg right"><div class="direct-chat-text">ola</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="659efca6-e2d5-4e4a-a7aa-9f6e056deb7c"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="eac2c45a-33ea-45be-824b-9dfa2b79c29d"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Or you can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Uber')">Uber</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2b5b902b-4e1c-0e3c-c94d-5fd7bf0f7c6e"><div class="direct-chat-msg right"><div class="direct-chat-text">Uber</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="51ee1640-95bf-4d20-987e-5800061e798d"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="440f92b7-0680-c379-1345-96b6ada25ba4"><div class="direct-chat-msg right"><div class="direct-chat-text">cancel</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:37 pm</span></div></div><div class="chat-individuals clearfix" id="9be75061-3c4b-4627-b37c-a7447719bf64"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>We'll meet again! </span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:37 pm</span></div></div></div></div>
<div class="box-body" style="flex: 1;overflow: hidden"><!-- Conversations are loaded here--><div class="direct-chat-messages"><!-- Message. Default to the left--><div class="chat-individuals clearfix" id="35e2e858-dece-eb9e-70b2-ced0d28849e3"><div class="direct-chat-msg right"><div class="direct-chat-text">hi</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="09ccac6a-00a0-493f-a489-621af631c5df"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Hello Kamala@96! I am Maya, your personal assistant. How may I help you?</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Book a cab')">Book a cab</div><div class="options-div" onclick="triggerAnswerNikki('Book a movie')">Book a movie</div><div class="options-div" onclick="triggerAnswerNikki('Recharge')">Recharge</div><div class="options-div" onclick="triggerAnswerNikki('Book Bus')">Book Bus</div><div class="options-div" onclick="triggerAnswerNikki('Play games')">Play games</div><div class="options-div" onclick="triggerAnswerNikki('News')">News</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="8808fb8f-5358-b71f-2240-a1480daa12ef"><div class="direct-chat-msg right"><div class="direct-chat-text">book a cab</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="5678e7f3-0c76-40b6-ad56-c2e8113f6657"><div class="direct-chat-msg left"><div class="direct-chat-text"><span></span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2141f74e-9250-4ea5-8876-ea0760839ae2"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Welcome ! Let me get you a cab. You can type <b>cancel</b> at any point to exit this conversation</span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="0e18992e-a084-4bcd-9407-0ce1c1cddede"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Your pickup location is: C1.04.08, Tower A, 4th Floor, Rattha Tek Meadows, Elcot Sez, Sholinganallur, Chennai </span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Change Source')">Change Source</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="b374870c-f988-4365-a279-1f83c115e21f"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>You can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Ola')">Ola</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="ad18d10f-21d9-40de-83c4-686cbcd16ada"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="f0f350c4-46d7-fc8f-e48b-943f23a8ec76"><div class="direct-chat-msg right"><div class="direct-chat-text">ola</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="659efca6-e2d5-4e4a-a7aa-9f6e056deb7c"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="eac2c45a-33ea-45be-824b-9dfa2b79c29d"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>Or you can change your cab preference from here.</span><div class="actionButton container-fluid"><div class="row"><div class="options-div" onclick="triggerAnswerNikki('Uber')">Uber</div><div class="options-div" onclick="triggerAnswerNikki('Cheapest Cab')">Cheapest Cab</div></div></div></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="2b5b902b-4e1c-0e3c-c94d-5fd7bf0f7c6e"><div class="direct-chat-msg right"><div class="direct-chat-text">Uber</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="51ee1640-95bf-4d20-987e-5800061e798d"><div class="direct-chat-msg left bus-cards-container"><div id="options" class="container-fluid"></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:36 pm</span></div></div><div class="chat-individuals clearfix" id="440f92b7-0680-c379-1345-96b6ada25ba4"><div class="direct-chat-msg right"><div class="direct-chat-text">cancel</div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-right">06:37 pm</span></div></div><div class="chat-individuals clearfix" id="9be75061-3c4b-4627-b37c-a7447719bf64"><div class="direct-chat-msg left"><div class="direct-chat-text"><span>We'll meet again! </span></div></div><div class="direct-chat-info clearfix"><span class="direct-chat-timestamp pull-left">06:37 pm</span></div></div></div></div>
html selenium selenium-webdriver xpath apache-poi
html selenium selenium-webdriver xpath apache-poi
edited Nov 15 '18 at 16:56
Ranjith Kasu
asked Nov 15 '18 at 10:16
Ranjith KasuRanjith Kasu
5510
5510
Can you share the URL of that chat client? In general, what I'm thinking is locate the class 'chat-individuals', go up one div and start a listener that watches if more 'chat-individuals' have appeared and takes the innerHTML from each new class. But the URL would be most helpful here.
– Alichino
Nov 15 '18 at 12:15
@Alichino even if I share URL is not enough for you. you have to get authorization by login id and password which is confidential. I can share you the entire HTML source code of a conversation between a user and chatbot. or please provide me your email id, I can try to send new temporary login id and pwd for you.
– Ranjith Kasu
Nov 15 '18 at 13:01
Let's try with the HTML, I'll see if I can do something with it.
– Alichino
Nov 15 '18 at 13:03
yeah, I have edited the body with updated HTML code, please have a look and let me know how to solve this problem
– Ranjith Kasu
Nov 15 '18 at 13:14
Hmm it's not easy... I'll try to think of something, after work maybe :)
– Alichino
Nov 15 '18 at 13:40
|
show 2 more comments
Can you share the URL of that chat client? In general, what I'm thinking is locate the class 'chat-individuals', go up one div and start a listener that watches if more 'chat-individuals' have appeared and takes the innerHTML from each new class. But the URL would be most helpful here.
– Alichino
Nov 15 '18 at 12:15
@Alichino even if I share URL is not enough for you. you have to get authorization by login id and password which is confidential. I can share you the entire HTML source code of a conversation between a user and chatbot. or please provide me your email id, I can try to send new temporary login id and pwd for you.
– Ranjith Kasu
Nov 15 '18 at 13:01
Let's try with the HTML, I'll see if I can do something with it.
– Alichino
Nov 15 '18 at 13:03
yeah, I have edited the body with updated HTML code, please have a look and let me know how to solve this problem
– Ranjith Kasu
Nov 15 '18 at 13:14
Hmm it's not easy... I'll try to think of something, after work maybe :)
– Alichino
Nov 15 '18 at 13:40
Can you share the URL of that chat client? In general, what I'm thinking is locate the class 'chat-individuals', go up one div and start a listener that watches if more 'chat-individuals' have appeared and takes the innerHTML from each new class. But the URL would be most helpful here.
– Alichino
Nov 15 '18 at 12:15
Can you share the URL of that chat client? In general, what I'm thinking is locate the class 'chat-individuals', go up one div and start a listener that watches if more 'chat-individuals' have appeared and takes the innerHTML from each new class. But the URL would be most helpful here.
– Alichino
Nov 15 '18 at 12:15
@Alichino even if I share URL is not enough for you. you have to get authorization by login id and password which is confidential. I can share you the entire HTML source code of a conversation between a user and chatbot. or please provide me your email id, I can try to send new temporary login id and pwd for you.
– Ranjith Kasu
Nov 15 '18 at 13:01
@Alichino even if I share URL is not enough for you. you have to get authorization by login id and password which is confidential. I can share you the entire HTML source code of a conversation between a user and chatbot. or please provide me your email id, I can try to send new temporary login id and pwd for you.
– Ranjith Kasu
Nov 15 '18 at 13:01
Let's try with the HTML, I'll see if I can do something with it.
– Alichino
Nov 15 '18 at 13:03
Let's try with the HTML, I'll see if I can do something with it.
– Alichino
Nov 15 '18 at 13:03
yeah, I have edited the body with updated HTML code, please have a look and let me know how to solve this problem
– Ranjith Kasu
Nov 15 '18 at 13:14
yeah, I have edited the body with updated HTML code, please have a look and let me know how to solve this problem
– Ranjith Kasu
Nov 15 '18 at 13:14
Hmm it's not easy... I'll try to think of something, after work maybe :)
– Alichino
Nov 15 '18 at 13:40
Hmm it's not easy... I'll try to think of something, after work maybe :)
– Alichino
Nov 15 '18 at 13:40
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317116%2fhow-to-get-data-from-dynamic-web-elementsid-and-write-that-data-in-excel-dynam%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317116%2fhow-to-get-data-from-dynamic-web-elementsid-and-write-that-data-in-excel-dynam%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you share the URL of that chat client? In general, what I'm thinking is locate the class 'chat-individuals', go up one div and start a listener that watches if more 'chat-individuals' have appeared and takes the innerHTML from each new class. But the URL would be most helpful here.
– Alichino
Nov 15 '18 at 12:15
@Alichino even if I share URL is not enough for you. you have to get authorization by login id and password which is confidential. I can share you the entire HTML source code of a conversation between a user and chatbot. or please provide me your email id, I can try to send new temporary login id and pwd for you.
– Ranjith Kasu
Nov 15 '18 at 13:01
Let's try with the HTML, I'll see if I can do something with it.
– Alichino
Nov 15 '18 at 13:03
yeah, I have edited the body with updated HTML code, please have a look and let me know how to solve this problem
– Ranjith Kasu
Nov 15 '18 at 13:14
Hmm it's not easy... I'll try to think of something, after work maybe :)
– Alichino
Nov 15 '18 at 13:40