Last active
April 16, 2021 11:41
-
-
Save riteshkawadkar/c9e0959e8014b8bba2d5ce0c2c9dd62a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Setup driver | |
| WebDriverManager.chromedriver().setup(); | |
| driver = new ChromeDriver(); | |
| driver.manage().window().maximize(); | |
| driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); | |
| driver.get("https://teams.microsoft.com/_?culture=en-in&country=IN&lm=deeplink&lmsrc=NeutralHomePageWeb&cmpid=WebSignIn#/conversations/19:meeting_NjAwYzNjMjYtZWIwYy00ODczLTg0YzMtNjEyNzI3YzdlZmRi@thread.v2?ctx=chat"); | |
| //Keep a breakpoint on below line and login to your account, open Chat and hit resume F8 | |
| //Identify Time on chat, only chat started by host will be identified | |
| List<WebElement> chatOriginsList = driver.findElements(By.xpath("//*[starts-with(@data-scroll-id,'8:orgid')]/div/thread/div//*[@id='messageBody']//*[@data-tid='messageTimeStamp']")); | |
| for (WebElement chat : chatOriginsList) { | |
| //get the timestamp of chat which is about to be deleted | |
| System.out.println(chat.getAttribute("title")); | |
| //perform mouse hover action on the chat bubble | |
| Actions action = new Actions(driver); | |
| action.moveToElement(chat); | |
| action.build().perform(); | |
| //click on 3 dots on popover menu | |
| driver.findElement(By.xpath("//*[@id='messageActions']/message-actions")).click(); | |
| Thread.sleep(1000); | |
| //click on delete | |
| driver.findElement(By.xpath("//*[@id='messageActionDropdown']/ul/li[3]/button/span")).click(); | |
| Thread.sleep(1000); | |
| } | |
| driver.quit(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment